bug: `next' did not work for numeric indices

This commit is contained in:
Roberto Ierusalimschy
2001-11-16 14:29:51 -02:00
parent 39395e1211
commit 657f65211a
2 changed files with 7 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: ltable.c,v 1.86 2001/09/07 17:30:16 roberto Exp $
** $Id: ltable.c,v 1.87 2001/10/25 19:14:14 roberto Exp $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@@ -96,7 +96,7 @@ int luaH_index (lua_State *L, Table *t, const TObject *key) {
if (ttype(key) == LUA_TNIL) return -1; /* first iteration */
i = arrayindex(key);
if (0 <= i && i < t->sizearray) { /* is `key' inside array part? */
return i; /* yes; that's the index */
return i-1; /* yes; that's the index (corrected to C) */
}
else {
const TObject *v = luaH_get(t, key);