diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-11-16 14:29:51 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-11-16 14:29:51 -0200 |
commit | 657f65211a5d836899d29b0a020a9ea4dff8cf51 (patch) | |
tree | 767d77883c9c2998b5cf23ddaf4ee5e98843fb7b /ltable.c | |
parent | 39395e12118539d983fdefbbc50d3aac3f53ccad (diff) | |
download | lua-657f65211a5d836899d29b0a020a9ea4dff8cf51.tar.gz lua-657f65211a5d836899d29b0a020a9ea4dff8cf51.tar.bz2 lua-657f65211a5d836899d29b0a020a9ea4dff8cf51.zip |
bug: `next' did not work for numeric indices
Diffstat (limited to 'ltable.c')
-rw-r--r-- | ltable.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 1.86 2001/09/07 17:30:16 roberto Exp $ | 2 | ** $Id: ltable.c,v 1.87 2001/10/25 19:14:14 roberto Exp $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -96,7 +96,7 @@ int luaH_index (lua_State *L, Table *t, const TObject *key) { | |||
96 | if (ttype(key) == LUA_TNIL) return -1; /* first iteration */ | 96 | if (ttype(key) == LUA_TNIL) return -1; /* first iteration */ |
97 | i = arrayindex(key); | 97 | i = arrayindex(key); |
98 | if (0 <= i && i < t->sizearray) { /* is `key' inside array part? */ | 98 | if (0 <= i && i < t->sizearray) { /* is `key' inside array part? */ |
99 | return i; /* yes; that's the index */ | 99 | return i-1; /* yes; that's the index (corrected to C) */ |
100 | } | 100 | } |
101 | else { | 101 | else { |
102 | const TObject *v = luaH_get(t, key); | 102 | const TObject *v = luaH_get(t, key); |