diff options
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.111 2010/07/02 11:38:13 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.112 2010/07/28 15:51:59 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 | */ |
@@ -727,24 +727,23 @@ static int string_query (lua_State *L) { | |||
727 | 727 | ||
728 | static int tref (lua_State *L) { | 728 | static int tref (lua_State *L) { |
729 | int level = lua_gettop(L); | 729 | int level = lua_gettop(L); |
730 | int lock = luaL_optint(L, 2, 1); | ||
731 | luaL_checkany(L, 1); | 730 | luaL_checkany(L, 1); |
732 | lua_pushvalue(L, 1); | 731 | lua_pushvalue(L, 1); |
733 | lua_pushinteger(L, lua_ref(L, lock)); | 732 | lua_pushinteger(L, luaL_ref(L, LUA_REGISTRYINDEX)); |
734 | lua_assert(lua_gettop(L) == level+1); /* +1 for result */ | 733 | lua_assert(lua_gettop(L) == level+1); /* +1 for result */ |
735 | return 1; | 734 | return 1; |
736 | } | 735 | } |
737 | 736 | ||
738 | static int getref (lua_State *L) { | 737 | static int getref (lua_State *L) { |
739 | int level = lua_gettop(L); | 738 | int level = lua_gettop(L); |
740 | lua_getref(L, luaL_checkint(L, 1)); | 739 | lua_rawgeti(L, LUA_REGISTRYINDEX, luaL_checkint(L, 1)); |
741 | lua_assert(lua_gettop(L) == level+1); | 740 | lua_assert(lua_gettop(L) == level+1); |
742 | return 1; | 741 | return 1; |
743 | } | 742 | } |
744 | 743 | ||
745 | static int unref (lua_State *L) { | 744 | static int unref (lua_State *L) { |
746 | int level = lua_gettop(L); | 745 | int level = lua_gettop(L); |
747 | lua_unref(L, luaL_checkint(L, 1)); | 746 | luaL_unref(L, LUA_REGISTRYINDEX, luaL_checkint(L, 1)); |
748 | lua_assert(lua_gettop(L) == level); | 747 | lua_assert(lua_gettop(L) == level); |
749 | return 0; | 748 | return 0; |
750 | } | 749 | } |