mirror of https://github.com/rusefi/lua.git
only tables need `lua_number2int'
This commit is contained in:
parent
76a73cb2ee
commit
68ee518e81
14
ltable.c
14
ltable.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: ltable.c,v 1.110 2002/06/13 13:39:55 roberto Exp roberto $
|
** $Id: ltable.c,v 1.111 2002/06/24 20:18:38 roberto Exp roberto $
|
||||||
** Lua tables (hash)
|
** Lua tables (hash)
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -46,8 +46,11 @@
|
||||||
#define toobig(x) ((((x)-1) >> MAXBITS) != 0)
|
#define toobig(x) ((((x)-1) >> MAXBITS) != 0)
|
||||||
|
|
||||||
|
|
||||||
|
/* function to convert a lua_Number to int (with any rounding method) */
|
||||||
|
#ifndef lua_number2int
|
||||||
|
#define lua_number2int(i,n) ((i)=(int)(n))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TagDefault LUA_TTABLE
|
|
||||||
|
|
||||||
|
|
||||||
#define hashnum(t,n) \
|
#define hashnum(t,n) \
|
||||||
|
@ -68,8 +71,11 @@
|
||||||
*/
|
*/
|
||||||
Node *luaH_mainposition (const Table *t, const TObject *key) {
|
Node *luaH_mainposition (const Table *t, const TObject *key) {
|
||||||
switch (ttype(key)) {
|
switch (ttype(key)) {
|
||||||
case LUA_TNUMBER:
|
case LUA_TNUMBER: {
|
||||||
return hashnum(t, nvalue(key));
|
int ikey;
|
||||||
|
lua_number2int(ikey, nvalue(key));
|
||||||
|
return hashnum(t, ikey);
|
||||||
|
}
|
||||||
case LUA_TSTRING:
|
case LUA_TSTRING:
|
||||||
return hashstr(t, tsvalue(key));
|
return hashstr(t, tsvalue(key));
|
||||||
case LUA_TBOOLEAN:
|
case LUA_TBOOLEAN:
|
||||||
|
|
8
lua.h
8
lua.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lua.h,v 1.143 2002/06/25 19:18:49 roberto Exp roberto $
|
** $Id: lua.h,v 1.144 2002/06/26 19:28:44 roberto Exp roberto $
|
||||||
** Lua - An Extensible Extension Language
|
** Lua - An Extensible Extension Language
|
||||||
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
|
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
|
||||||
** http://www.lua.org mailto:info@lua.org
|
** http://www.lua.org mailto:info@lua.org
|
||||||
|
@ -301,12 +301,6 @@ LUA_API int lua_pushupvalues (lua_State *L);
|
||||||
#define LUA_NUMBER_FMT "%.16g"
|
#define LUA_NUMBER_FMT "%.16g"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* function to convert a lua_Number to int (with any rounding method) */
|
|
||||||
#ifndef lua_number2int
|
|
||||||
#define lua_number2int(i,n) ((i)=(int)(n))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* }====================================================================== */
|
/* }====================================================================== */
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue