Browse Source

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

Roberto Ierusalimschy 23 years ago
parent
commit
22dd271cbb
1 changed files with 2 additions and 2 deletions
  1. 2 2
      ltable.c

+ 2 - 2
ltable.c

@@ -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)
 ** See Copyright Notice in lua.h
 */
@@ -97,7 +97,7 @@ int luaH_index (lua_State *L, Table *t, const TObject *key) {
   int i;
   if (ttype(key) == LUA_TNIL) return -1;  /* first iteration */
   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) */
   }
   else {