diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-03-11 12:51:08 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-03-11 12:51:08 -0300 |
| commit | 6bfef60e77f5eec1057470010b4179ee6f830fe6 (patch) | |
| tree | 49454e412c34c5d5d88e5321456bbeadc15ee046 | |
| parent | 370d31a5593220723d222dec6e3e4019decc3309 (diff) | |
| download | lua-6bfef60e77f5eec1057470010b4179ee6f830fe6.tar.gz lua-6bfef60e77f5eec1057470010b4179ee6f830fe6.tar.bz2 lua-6bfef60e77f5eec1057470010b4179ee6f830fe6.zip | |
bug: rawset/rawget do not ignore extra arguments
| -rw-r--r-- | bugs | 21 | ||||
| -rw-r--r-- | lbaselib.c | 4 |
2 files changed, 24 insertions, 1 deletions
| @@ -743,3 +743,24 @@ patch = [[ | |||
| 743 | ]], | 743 | ]], |
| 744 | } | 744 | } |
| 745 | 745 | ||
| 746 | |||
| 747 | Bug{ | ||
| 748 | what = [[rawset/rawget do not ignore extra arguments]], | ||
| 749 | |||
| 750 | report = [[Romulo Bahiense, 11/03/2005]], | ||
| 751 | |||
| 752 | example = [[ | ||
| 753 | a = {} | ||
| 754 | rawset(a, 1, 2, 3) | ||
| 755 | print(a[1], a[2]) -- should be 2 and nil | ||
| 756 | ]], | ||
| 757 | |||
| 758 | patch = [[ | ||
| 759 | * lbaselib.c: | ||
| 760 | 175a176 | ||
| 761 | > lua_settop(L, 2); | ||
| 762 | 183a185 | ||
| 763 | > lua_settop(L, 3); | ||
| 764 | ]], | ||
| 765 | } | ||
| 766 | |||
| @@ -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) { | |||
| 164 | static int luaB_rawget (lua_State *L) { | 164 | static 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 | } |
