aboutsummaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-05-20 12:53:42 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-05-20 12:53:42 -0300
commitf21e9c172f9f15d8d7501e35635e78dc11f5ff58 (patch)
treecb50795d8bceff944dd8f7d75626069491d5e8d0 /ltable.c
parent67578ec51f1a3ec2c967f15d370067caf9e0b87b (diff)
downloadlua-f21e9c172f9f15d8d7501e35635e78dc11f5ff58.tar.gz
lua-f21e9c172f9f15d8d7501e35635e78dc11f5ff58.tar.bz2
lua-f21e9c172f9f15d8d7501e35635e78dc11f5ff58.zip
details
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ltable.c b/ltable.c
index 76e25bc4..5099d506 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 2.22 2005/05/16 21:19:00 roberto Exp roberto $ 2** $Id: ltable.c,v 2.23 2005/05/17 19:49:15 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*/
@@ -120,7 +120,7 @@ static int arrayindex (const TValue *key) {
120 lua_Number n = nvalue(key); 120 lua_Number n = nvalue(key);
121 int k; 121 int k;
122 lua_number2int(k, n); 122 lua_number2int(k, n);
123 if (luai_numeq(cast(lua_Number, k), nvalue(key))) 123 if (luai_numeq(L, cast(lua_Number, k), nvalue(key)))
124 return k; 124 return k;
125 } 125 }
126 return -1; /* `key' did not match some condition */ 126 return -1; /* `key' did not match some condition */
@@ -437,7 +437,7 @@ const TValue *luaH_getnum (Table *t, int key) {
437 lua_Number nk = cast(lua_Number, key); 437 lua_Number nk = cast(lua_Number, key);
438 Node *n = hashnum(t, nk); 438 Node *n = hashnum(t, nk);
439 do { /* check whether `key' is somewhere in the chain */ 439 do { /* check whether `key' is somewhere in the chain */
440 if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk)) 440 if (ttisnumber(gkey(n)) && luai_numeq(L, nvalue(gkey(n)), nk))
441 return gval(n); /* that's it */ 441 return gval(n); /* that's it */
442 else n = gnext(n); 442 else n = gnext(n);
443 } while (n); 443 } while (n);
@@ -471,7 +471,7 @@ const TValue *luaH_get (Table *t, const TValue *key) {
471 int k; 471 int k;
472 lua_Number n = nvalue(key); 472 lua_Number n = nvalue(key);
473 lua_number2int(k, n); 473 lua_number2int(k, n);
474 if (luai_numeq(cast(lua_Number, k), nvalue(key))) /* index is integer? */ 474 if (luai_numeq(L, cast(lua_Number, k), nvalue(key))) /* index is int? */
475 return luaH_getnum(t, k); /* use specialized version */ 475 return luaH_getnum(t, k); /* use specialized version */
476 /* else go through */ 476 /* else go through */
477 } 477 }
@@ -495,7 +495,7 @@ TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
495 return cast(TValue *, p); 495 return cast(TValue *, p);
496 else { 496 else {
497 if (ttisnil(key)) luaG_runerror(L, "table index is nil"); 497 if (ttisnil(key)) luaG_runerror(L, "table index is nil");
498 else if (ttisnumber(key) && !luai_numeq(nvalue(key), nvalue(key))) 498 else if (ttisnumber(key) && !luai_numeq(L, nvalue(key), nvalue(key)))
499 luaG_runerror(L, "table index is NaN"); 499 luaG_runerror(L, "table index is NaN");
500 return newkey(L, t, key); 500 return newkey(L, t, key);
501 } 501 }