diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-09-25 11:48:42 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-09-25 11:48:42 -0300 |
commit | c2aa7bd72d620731b5a54b532523dbd9f8e1bfc3 (patch) | |
tree | b95f235c517d499fc50b1a6c9061928f496e37de | |
parent | f9dd50cefc6c1c2c57f24d9985c1cc073d9d7300 (diff) | |
download | lua-c2aa7bd72d620731b5a54b532523dbd9f8e1bfc3.tar.gz lua-c2aa7bd72d620731b5a54b532523dbd9f8e1bfc3.tar.bz2 lua-c2aa7bd72d620731b5a54b532523dbd9f8e1bfc3.zip |
bug: lua_gettable does not get key from stack top
-rw-r--r-- | bugs | 5 | ||||
-rw-r--r-- | ltests.c | 8 | ||||
-rw-r--r-- | lvm.c | 4 |
3 files changed, 14 insertions, 3 deletions
@@ -208,3 +208,8 @@ Fri Sep 22 15:12:37 EST 2000 | |||
208 | >> `read("*w")' should return nil at EOF | 208 | >> `read("*w")' should return nil at EOF |
209 | (by roberto; since 4.0b) | 209 | (by roberto; since 4.0b) |
210 | 210 | ||
211 | ** lvm.c | ||
212 | Mon Sep 25 11:47:48 EST 2000 | ||
213 | >> lua_gettable does not get key from stack top | ||
214 | (by Philip Yi; since 4.0b) | ||
215 | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.41 2000/09/11 19:42:57 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.42 2000/09/14 14:09:31 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -410,6 +410,12 @@ static int testC (lua_State *L) { | |||
410 | else if EQ("insert") { | 410 | else if EQ("insert") { |
411 | lua_insert(L, getnum); | 411 | lua_insert(L, getnum); |
412 | } | 412 | } |
413 | else if EQ("gettable") { | ||
414 | lua_gettable(L, getnum); | ||
415 | } | ||
416 | else if EQ("settable") { | ||
417 | lua_settable(L, getnum); | ||
418 | } | ||
413 | else if EQ("next") { | 419 | else if EQ("next") { |
414 | lua_next(L, -2); | 420 | lua_next(L, -2); |
415 | } | 421 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.135 2000/09/11 17:38:42 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.136 2000/09/20 17:57:08 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -120,7 +120,7 @@ const TObject *luaV_gettable (lua_State *L, StkId t) { | |||
120 | ((tg = hvalue(t)->htag) == TAG_TABLE || /* with default tag? */ | 120 | ((tg = hvalue(t)->htag) == TAG_TABLE || /* with default tag? */ |
121 | ttype(luaT_getim(L, tg, IM_GETTABLE)) == TAG_NIL)) { /* or no TM? */ | 121 | ttype(luaT_getim(L, tg, IM_GETTABLE)) == TAG_NIL)) { /* or no TM? */ |
122 | /* do a primitive get */ | 122 | /* do a primitive get */ |
123 | const TObject *h = luaH_get(L, hvalue(t), t+1); | 123 | const TObject *h = luaH_get(L, hvalue(t), L->top-1); |
124 | /* result is no nil or there is no `index' tag method? */ | 124 | /* result is no nil or there is no `index' tag method? */ |
125 | if (ttype(h) != TAG_NIL || | 125 | if (ttype(h) != TAG_NIL || |
126 | (ttype(im=luaT_getim(L, tg, IM_INDEX)) == TAG_NIL)) | 126 | (ttype(im=luaT_getim(L, tg, IM_INDEX)) == TAG_NIL)) |