another bug in next (when n is a power of 2)

This commit is contained in:
Roberto Ierusalimschy 2001-12-19 16:11:00 -02:00
parent e04f7ed450
commit 22dd271cbb
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: ltable.c,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $ ** $Id: ltable.c,v 1.93 2001/12/11 22:48:44 roberto Exp roberto $
** Lua tables (hash) ** Lua tables (hash)
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -97,7 +97,7 @@ int luaH_index (lua_State *L, Table *t, const TObject *key) {
int i; int i;
if (ttype(key) == LUA_TNIL) return -1; /* first iteration */ if (ttype(key) == LUA_TNIL) return -1; /* first iteration */
i = arrayindex(key); i = arrayindex(key);
if (0 <= i && i < t->sizearray) { /* is `key' inside array part? */ if (0 <= i && i <= t->sizearray) { /* is `key' inside array part? */
return i-1; /* yes; that's the index (corrected to C) */ return i-1; /* yes; that's the index (corrected to C) */
} }
else { else {