aboutsummaryrefslogtreecommitdiff
path: root/ldblib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldblib.c')
-rw-r--r--ldblib.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ldblib.c b/ldblib.c
index 64158395..9f7aad51 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -65,7 +65,7 @@ static int db_setmetatable (lua_State *L) {
65static int db_getuservalue (lua_State *L) { 65static int db_getuservalue (lua_State *L) {
66 int n = (int)luaL_optinteger(L, 2, 1); 66 int n = (int)luaL_optinteger(L, 2, 1);
67 if (lua_type(L, 1) != LUA_TUSERDATA) 67 if (lua_type(L, 1) != LUA_TUSERDATA)
68 lua_pushnil(L); 68 luaL_pushfail(L);
69 else if (lua_getiuservalue(L, 1, n) != LUA_TNONE) { 69 else if (lua_getiuservalue(L, 1, n) != LUA_TNONE) {
70 lua_pushboolean(L, 1); 70 lua_pushboolean(L, 1);
71 return 2; 71 return 2;
@@ -80,7 +80,7 @@ static int db_setuservalue (lua_State *L) {
80 luaL_checkany(L, 2); 80 luaL_checkany(L, 2);
81 lua_settop(L, 2); 81 lua_settop(L, 2);
82 if (!lua_setiuservalue(L, 1, n)) 82 if (!lua_setiuservalue(L, 1, n))
83 lua_pushnil(L); 83 luaL_pushfail(L);
84 return 1; 84 return 1;
85} 85}
86 86
@@ -159,7 +159,7 @@ static int db_getinfo (lua_State *L) {
159 } 159 }
160 else { /* stack level */ 160 else { /* stack level */
161 if (!lua_getstack(L1, (int)luaL_checkinteger(L, arg + 1), &ar)) { 161 if (!lua_getstack(L1, (int)luaL_checkinteger(L, arg + 1), &ar)) {
162 lua_pushnil(L); /* level out of range */ 162 luaL_pushfail(L); /* level out of range */
163 return 1; 163 return 1;
164 } 164 }
165 } 165 }
@@ -223,7 +223,7 @@ static int db_getlocal (lua_State *L) {
223 return 2; 223 return 2;
224 } 224 }
225 else { 225 else {
226 lua_pushnil(L); /* no name (nor value) */ 226 luaL_pushfail(L); /* no name (nor value) */
227 return 1; 227 return 1;
228 } 228 }
229 } 229 }
@@ -389,8 +389,10 @@ static int db_gethook (lua_State *L) {
389 char buff[5]; 389 char buff[5];
390 int mask = lua_gethookmask(L1); 390 int mask = lua_gethookmask(L1);
391 lua_Hook hook = lua_gethook(L1); 391 lua_Hook hook = lua_gethook(L1);
392 if (hook == NULL) /* no hook? */ 392 if (hook == NULL) { /* no hook? */
393 lua_pushnil(L); 393 luaL_pushfail(L);
394 return 1;
395 }
394 else if (hook != hookf) /* external hook? */ 396 else if (hook != hookf) /* external hook? */
395 lua_pushliteral(L, "external hook"); 397 lua_pushliteral(L, "external hook");
396 else { /* hook table must exist */ 398 else { /* hook table must exist */