better implementation for list "for"
This commit is contained in:
11
ltable.c
11
ltable.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltable.c,v 1.69 2001/01/26 14:16:35 roberto Exp roberto $
|
||||
** $Id: ltable.c,v 1.70 2001/01/26 15:58:50 roberto Exp roberto $
|
||||
** Lua tables (hash)
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -72,6 +72,15 @@ Node *luaH_next (lua_State *L, Hash *t, const TObject *key) {
|
||||
}
|
||||
|
||||
|
||||
int luaH_nexti (Hash *t, int i) {
|
||||
for (i++; i<t->size; i++) {
|
||||
if (ttype(val(node(t, i))) != LUA_TNIL) /* a non-nil value? */
|
||||
return i;
|
||||
}
|
||||
return -1; /* no more elements */
|
||||
}
|
||||
|
||||
|
||||
static void setnodevector (lua_State *L, Hash *t, luint32 size) {
|
||||
int i;
|
||||
if (size > MAX_INT)
|
||||
|
||||
Reference in New Issue
Block a user