aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/ltests.c b/ltests.c
index 097f7d1b..b21ffc62 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 1.113 2002/03/20 12:54:08 roberto Exp roberto $ 2** $Id: ltests.c,v 1.114 2002/03/25 17:47:14 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -349,8 +349,10 @@ static int unref (lua_State *L) {
349 349
350static int metatable (lua_State *L) { 350static int metatable (lua_State *L) {
351 luaL_check_any(L, 1); 351 luaL_check_any(L, 1);
352 if (lua_isnone(L, 2)) 352 if (lua_isnone(L, 2)) {
353 lua_getmetatable(L, 1); 353 if (lua_getmetatable(L, 1) == 0)
354 lua_pushnil(L);
355 }
354 else { 356 else {
355 lua_settop(L, 2); 357 lua_settop(L, 2);
356 luaL_check_type(L, 2, LUA_TTABLE); 358 luaL_check_type(L, 2, LUA_TTABLE);
@@ -627,7 +629,8 @@ static int testC (lua_State *L) {
627 lua_setmetatable(L, getnum); 629 lua_setmetatable(L, getnum);
628 } 630 }
629 else if EQ("getmetatable") { 631 else if EQ("getmetatable") {
630 lua_getmetatable(L, getnum); 632 if (lua_getmetatable(L, getnum) == 0)
633 lua_pushnil(L);
631 } 634 }
632 else if EQ("type") { 635 else if EQ("type") {
633 lua_pushstring(L, lua_typename(L, lua_type(L, getnum))); 636 lua_pushstring(L, lua_typename(L, lua_type(L, getnum)));
@@ -682,7 +685,7 @@ static void fim (void) {
682void luaB_opentests (lua_State *L) { 685void luaB_opentests (lua_State *L) {
683 *cast(int **, L) = &islocked; /* init lock */ 686 *cast(int **, L) = &islocked; /* init lock */
684 lua_state = L; /* keep first state to be opened */ 687 lua_state = L; /* keep first state to be opened */
685 luaL_opennamedlib(L, "T", tests_funcs); 688 luaL_opennamedlib(L, "T", tests_funcs, 0);
686 atexit(fim); 689 atexit(fim);
687} 690}
688 691