diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-03-12 17:57:40 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-03-12 17:57:40 -0300 |
commit | a3addae03634794b841b6c8c4dd8ff83542d8896 (patch) | |
tree | 66695864f7bd56c295ad7cd6a6465845103cd424 /loslib.c | |
parent | ad40bb1181d08821af6789147a28aa8370533d11 (diff) | |
download | lua-a3addae03634794b841b6c8c4dd8ff83542d8896.tar.gz lua-a3addae03634794b841b6c8c4dd8ff83542d8896.tar.bz2 lua-a3addae03634794b841b6c8c4dd8ff83542d8896.zip |
lua_gettable and similars return type of gotten value
Diffstat (limited to 'loslib.c')
-rw-r--r-- | loslib.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loslib.c,v 1.42 2014/02/26 15:27:56 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.43 2014/02/26 15:55:58 roberto Exp roberto $ |
3 | ** Standard Operating System library | 3 | ** Standard Operating System library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -158,8 +158,7 @@ static void setboolfield (lua_State *L, const char *key, int value) { | |||
158 | 158 | ||
159 | static int getboolfield (lua_State *L, const char *key) { | 159 | static int getboolfield (lua_State *L, const char *key) { |
160 | int res; | 160 | int res; |
161 | lua_getfield(L, -1, key); | 161 | res = (lua_getfield(L, -1, key) == LUA_TNIL) ? -1 : lua_toboolean(L, -1); |
162 | res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1); | ||
163 | lua_pop(L, 1); | 162 | lua_pop(L, 1); |
164 | return res; | 163 | return res; |
165 | } | 164 | } |