aboutsummaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ltable.c b/ltable.c
index b8244dca..37fc3d0b 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 2.123 2017/06/09 16:48:44 roberto Exp roberto $ 2** $Id: ltable.c,v 2.124 2017/06/12 14:21:44 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*/
@@ -211,7 +211,7 @@ static unsigned int arrayindex (lua_Integer k) {
211** elements in the array part, then elements in the hash part. The 211** elements in the array part, then elements in the hash part. The
212** beginning of a traversal is signaled by 0. 212** beginning of a traversal is signaled by 0.
213*/ 213*/
214static unsigned int findindex (lua_State *L, Table *t, StkId key) { 214static unsigned int findindex (lua_State *L, Table *t, TValue *key) {
215 unsigned int i; 215 unsigned int i;
216 if (ttisnil(key)) return 0; /* first iteration */ 216 if (ttisnil(key)) return 0; /* first iteration */
217 i = ttisinteger(key) ? arrayindex(ivalue(key)) : 0; 217 i = ttisinteger(key) ? arrayindex(ivalue(key)) : 0;
@@ -229,18 +229,18 @@ static unsigned int findindex (lua_State *L, Table *t, StkId key) {
229 229
230 230
231int luaH_next (lua_State *L, Table *t, StkId key) { 231int luaH_next (lua_State *L, Table *t, StkId key) {
232 unsigned int i = findindex(L, t, key); /* find original element */ 232 unsigned int i = findindex(L, t, s2v(key)); /* find original element */
233 for (; i < t->sizearray; i++) { /* try first array part */ 233 for (; i < t->sizearray; i++) { /* try first array part */
234 if (!ttisnil(&t->array[i])) { /* a non-nil value? */ 234 if (!ttisnil(&t->array[i])) { /* a non-nil value? */
235 setivalue(key, i + 1); 235 setivalue(s2v(key), i + 1);
236 setobj2s(L, key+1, &t->array[i]); 236 setobj2s(L, key + 1, &t->array[i]);
237 return 1; 237 return 1;
238 } 238 }
239 } 239 }
240 for (i -= t->sizearray; cast_int(i) < sizenode(t); i++) { /* hash part */ 240 for (i -= t->sizearray; cast_int(i) < sizenode(t); i++) { /* hash part */
241 if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ 241 if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */
242 Node *n = gnode(t, i); 242 Node *n = gnode(t, i);
243 getnodekey(L, key, n); 243 getnodekey(L, s2v(key), n);
244 setobj2s(L, key + 1, gval(n)); 244 setobj2s(L, key + 1, gval(n));
245 return 1; 245 return 1;
246 } 246 }