aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-25 11:48:42 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-25 11:48:42 -0300
commitc2aa7bd72d620731b5a54b532523dbd9f8e1bfc3 (patch)
treeb95f235c517d499fc50b1a6c9061928f496e37de
parentf9dd50cefc6c1c2c57f24d9985c1cc073d9d7300 (diff)
downloadlua-c2aa7bd72d620731b5a54b532523dbd9f8e1bfc3.tar.gz
lua-c2aa7bd72d620731b5a54b532523dbd9f8e1bfc3.tar.bz2
lua-c2aa7bd72d620731b5a54b532523dbd9f8e1bfc3.zip
bug: lua_gettable does not get key from stack top
-rw-r--r--bugs5
-rw-r--r--ltests.c8
-rw-r--r--lvm.c4
3 files changed, 14 insertions, 3 deletions
diff --git a/bugs b/bugs
index 780b164a..b668cc00 100644
--- a/bugs
+++ b/bugs
@@ -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
212Mon 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
diff --git a/ltests.c b/ltests.c
index 04cd1b40..fe0ed439 100644
--- a/ltests.c
+++ b/ltests.c
@@ -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 }
diff --git a/lvm.c b/lvm.c
index 22ff9ae7..365fb42d 100644
--- a/lvm.c
+++ b/lvm.c
@@ -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))