diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-27 14:48:28 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-27 14:48:28 -0300 |
| commit | b7edf5d2d89ed2ce1e9087de496bcb451e39d131 (patch) | |
| tree | 88d94c159ee2034fffd9195a60e306c9565bf361 /lbaselib.c | |
| parent | ef8263f81fdde2310ebb15c9a3fe5e954d57cab5 (diff) | |
| download | lua-b7edf5d2d89ed2ce1e9087de496bcb451e39d131.tar.gz lua-b7edf5d2d89ed2ce1e9087de496bcb451e39d131.tar.bz2 lua-b7edf5d2d89ed2ce1e9087de496bcb451e39d131.zip | |
metamethods for 'removekey'/'keyin'
Diffstat (limited to 'lbaselib.c')
| -rw-r--r-- | lbaselib.c | 8 |
1 files changed, 3 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.319 2018/02/05 17:10:52 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.320 2018/02/25 12:48:16 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 | */ |
| @@ -171,8 +171,7 @@ static int luaB_rawset (lua_State *L) { | |||
| 171 | 171 | ||
| 172 | 172 | ||
| 173 | static int luaB_keyin (lua_State *L) { | 173 | static int luaB_keyin (lua_State *L) { |
| 174 | luaL_checktype(L, 1, LUA_TTABLE); | 174 | luaL_checkany(L, 2); /* ensures a first argument too */ |
| 175 | luaL_checkany(L, 2); | ||
| 176 | lua_settop(L, 2); | 175 | lua_settop(L, 2); |
| 177 | lua_pushboolean(L, lua_keyin(L, 1)); | 176 | lua_pushboolean(L, lua_keyin(L, 1)); |
| 178 | return 1; | 177 | return 1; |
| @@ -180,8 +179,7 @@ static int luaB_keyin (lua_State *L) { | |||
| 180 | 179 | ||
| 181 | 180 | ||
| 182 | static int luaB_removekey (lua_State *L) { | 181 | static int luaB_removekey (lua_State *L) { |
| 183 | luaL_checktype(L, 1, LUA_TTABLE); | 182 | luaL_checkany(L, 2); /* ensures a first argument too */ |
| 184 | luaL_checkany(L, 2); | ||
| 185 | lua_settop(L, 2); | 183 | lua_settop(L, 2); |
| 186 | lua_removekey(L, 1); | 184 | lua_removekey(L, 1); |
| 187 | return 0; | 185 | return 0; |
