diff options
Diffstat (limited to 'ltable.c')
-rw-r--r-- | ltable.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 1.69 2001/01/26 14:16:35 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 1.70 2001/01/26 15:58:50 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 | */ |
@@ -72,6 +72,15 @@ Node *luaH_next (lua_State *L, Hash *t, const TObject *key) { | |||
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | int luaH_nexti (Hash *t, int i) { | ||
76 | for (i++; i<t->size; i++) { | ||
77 | if (ttype(val(node(t, i))) != LUA_TNIL) /* a non-nil value? */ | ||
78 | return i; | ||
79 | } | ||
80 | return -1; /* no more elements */ | ||
81 | } | ||
82 | |||
83 | |||
75 | static void setnodevector (lua_State *L, Hash *t, luint32 size) { | 84 | static void setnodevector (lua_State *L, Hash *t, luint32 size) { |
76 | int i; | 85 | int i; |
77 | if (size > MAX_INT) | 86 | if (size > MAX_INT) |