diff options
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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 | ||
350 | static int metatable (lua_State *L) { | 350 | static 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) { | |||
682 | void luaB_opentests (lua_State *L) { | 685 | void 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 | ||