aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ltable.c14
-rw-r--r--lua.h8
2 files changed, 11 insertions, 11 deletions
diff --git a/ltable.c b/ltable.c
index faae28cf..ba0919f3 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.110 2002/06/13 13:39:55 roberto Exp roberto $ 2** $Id: ltable.c,v 1.111 2002/06/24 20:18:38 roberto Exp roberto $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -46,8 +46,11 @@
46#define toobig(x) ((((x)-1) >> MAXBITS) != 0) 46#define toobig(x) ((((x)-1) >> MAXBITS) != 0)
47 47
48 48
49/* function to convert a lua_Number to int (with any rounding method) */
50#ifndef lua_number2int
51#define lua_number2int(i,n) ((i)=(int)(n))
52#endif
49 53
50#define TagDefault LUA_TTABLE
51 54
52 55
53#define hashnum(t,n) \ 56#define hashnum(t,n) \
@@ -68,8 +71,11 @@
68*/ 71*/
69Node *luaH_mainposition (const Table *t, const TObject *key) { 72Node *luaH_mainposition (const Table *t, const TObject *key) {
70 switch (ttype(key)) { 73 switch (ttype(key)) {
71 case LUA_TNUMBER: 74 case LUA_TNUMBER: {
72 return hashnum(t, nvalue(key)); 75 int ikey;
76 lua_number2int(ikey, nvalue(key));
77 return hashnum(t, ikey);
78 }
73 case LUA_TSTRING: 79 case LUA_TSTRING:
74 return hashstr(t, tsvalue(key)); 80 return hashstr(t, tsvalue(key));
75 case LUA_TBOOLEAN: 81 case LUA_TBOOLEAN:
diff --git a/lua.h b/lua.h
index 6cbf9497..014896b0 100644
--- a/lua.h
+++ b/lua.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.h,v 1.143 2002/06/25 19:18:49 roberto Exp roberto $ 2** $Id: lua.h,v 1.144 2002/06/26 19:28:44 roberto Exp roberto $
3** Lua - An Extensible Extension Language 3** Lua - An Extensible Extension Language
4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil 4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
5** http://www.lua.org mailto:info@lua.org 5** http://www.lua.org mailto:info@lua.org
@@ -301,12 +301,6 @@ LUA_API int lua_pushupvalues (lua_State *L);
301#define LUA_NUMBER_FMT "%.16g" 301#define LUA_NUMBER_FMT "%.16g"
302#endif 302#endif
303 303
304
305/* function to convert a lua_Number to int (with any rounding method) */
306#ifndef lua_number2int
307#define lua_number2int(i,n) ((i)=(int)(n))
308#endif
309
310/* }====================================================================== */ 304/* }====================================================================== */
311 305
312 306