aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-03-11 12:51:08 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-03-11 12:51:08 -0300
commit6bfef60e77f5eec1057470010b4179ee6f830fe6 (patch)
tree49454e412c34c5d5d88e5321456bbeadc15ee046
parent370d31a5593220723d222dec6e3e4019decc3309 (diff)
downloadlua-6bfef60e77f5eec1057470010b4179ee6f830fe6.tar.gz
lua-6bfef60e77f5eec1057470010b4179ee6f830fe6.tar.bz2
lua-6bfef60e77f5eec1057470010b4179ee6f830fe6.zip
bug: rawset/rawget do not ignore extra arguments
-rw-r--r--bugs21
-rw-r--r--lbaselib.c4
2 files changed, 24 insertions, 1 deletions
diff --git a/bugs b/bugs
index efff0bbe..a537f84e 100644
--- a/bugs
+++ b/bugs
@@ -743,3 +743,24 @@ patch = [[
743]], 743]],
744} 744}
745 745
746
747Bug{
748what = [[rawset/rawget do not ignore extra arguments]],
749
750report = [[Romulo Bahiense, 11/03/2005]],
751
752example = [[
753a = {}
754rawset(a, 1, 2, 3)
755print(a[1], a[2]) -- should be 2 and nil
756]],
757
758patch = [[
759* lbaselib.c:
760175a176
761> lua_settop(L, 2);
762183a185
763> lua_settop(L, 3);
764]],
765}
766
diff --git a/lbaselib.c b/lbaselib.c
index 3936c5c7..442ca621 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.168 2005/02/23 17:30:22 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.169 2005/02/28 17:24:41 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -164,6 +164,7 @@ static int luaB_rawequal (lua_State *L) {
164static int luaB_rawget (lua_State *L) { 164static int luaB_rawget (lua_State *L) {
165 luaL_checktype(L, 1, LUA_TTABLE); 165 luaL_checktype(L, 1, LUA_TTABLE);
166 luaL_checkany(L, 2); 166 luaL_checkany(L, 2);
167 lua_settop(L, 2);
167 lua_rawget(L, 1); 168 lua_rawget(L, 1);
168 return 1; 169 return 1;
169} 170}
@@ -172,6 +173,7 @@ static int luaB_rawset (lua_State *L) {
172 luaL_checktype(L, 1, LUA_TTABLE); 173 luaL_checktype(L, 1, LUA_TTABLE);
173 luaL_checkany(L, 2); 174 luaL_checkany(L, 2);
174 luaL_checkany(L, 3); 175 luaL_checkany(L, 3);
176 lua_settop(L, 3);
175 lua_rawset(L, 1); 177 lua_rawset(L, 1);
176 return 1; 178 return 1;
177} 179}