Explorar o código

new function 'getregistry'

Roberto Ierusalimschy %!s(int64=20) %!d(string=hai) anos
pai
achega
d4c99b2673
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      ldblib.c

+ 8 - 1
ldblib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ldblib.c,v 1.101 2005/08/26 17:36:32 roberto Exp roberto $
+** $Id: ldblib.c,v 1.102 2005/10/19 13:05:11 roberto Exp roberto $
 ** Interface from Lua to its debug API
 ** See Copyright Notice in lua.h
 */
@@ -19,6 +19,12 @@
 
 
 
+static int db_getregistry (lua_State *L) {
+  lua_pushvalue(L, LUA_REGISTRYINDEX);
+  return 1;
+}
+
+
 static int db_getmetatable (lua_State *L) {
   luaL_checkany(L, 1);
   if (!lua_getmetatable(L, 1)) {
@@ -371,6 +377,7 @@ static const luaL_Reg dblib[] = {
   {"gethook", db_gethook},
   {"getinfo", db_getinfo},
   {"getlocal", db_getlocal},
+  {"getregistry", db_getregistry},
   {"getmetatable", db_getmetatable},
   {"getupvalue", db_getupvalue},
   {"setfenv", db_setfenv},