aboutsummaryrefslogtreecommitdiff
path: root/loslib.c
diff options
context:
space:
mode:
Diffstat (limited to 'loslib.c')
-rw-r--r--loslib.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/loslib.c b/loslib.c
index 3e9a1bf8..b301681f 100644
--- a/loslib.c
+++ b/loslib.c
@@ -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
159static int getboolfield (lua_State *L, const char *key) { 159static 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}