Ver Fonte

add: 启用debug库,但是暂不支持debug.debug()调用

Wendal Chen há 6 anos atrás
pai
commit
ac7b319133
2 ficheiros alterados com 21 adições e 21 exclusões
  1. 20 20
      lua/src/ldblib.c
  2. 1 1
      lua/src/linit.c

+ 20 - 20
lua/src/ldblib.c

@@ -427,30 +427,30 @@ static int db_traceback (lua_State *L) {
   return 1;
 }
 
-
-static const luaL_Reg dblib[] = {
-  {"debug", db_debug},
-  {"getuservalue", db_getuservalue},
-  {"gethook", db_gethook},
-  {"getinfo", db_getinfo},
-  {"getlocal", db_getlocal},
-  {"getregistry", db_getregistry},
-  {"getmetatable", db_getmetatable},
-  {"getupvalue", db_getupvalue},
-  {"upvaluejoin", db_upvaluejoin},
-  {"upvalueid", db_upvalueid},
-  {"setuservalue", db_setuservalue},
-  {"sethook", db_sethook},
-  {"setlocal", db_setlocal},
-  {"setmetatable", db_setmetatable},
-  {"setupvalue", db_setupvalue},
-  {"traceback", db_traceback},
-  {NULL, NULL}
+#include "rotable.h"
+static const rotable_Reg dblib[] = {
+//  {"debug", db_debug, 0},
+  {"getuservalue", db_getuservalue, 0},
+  {"gethook", db_gethook, 0},
+  {"getinfo", db_getinfo, 0},
+  {"getlocal", db_getlocal, 0},
+  {"getregistry", db_getregistry, 0},
+  {"getmetatable", db_getmetatable, 0},
+  {"getupvalue", db_getupvalue, 0},
+  {"upvaluejoin", db_upvaluejoin, 0},
+  {"upvalueid", db_upvalueid, 0},
+  {"setuservalue", db_setuservalue, 0},
+  {"sethook", db_sethook, 0},
+  {"setlocal", db_setlocal, 0},
+  {"setmetatable", db_setmetatable, 0},
+  {"setupvalue", db_setupvalue, 0},
+  {"traceback", db_traceback, 0},
+  {NULL, NULL, 0}
 };
 
 
 LUAMOD_API int luaopen_debug (lua_State *L) {
-  luaL_newlib(L, dblib);
+  rotable_newlib(L, dblib);
   return 1;
 }
 

+ 1 - 1
lua/src/linit.c

@@ -49,7 +49,7 @@ static const luaL_Reg loadedlibs[] = {
   {LUA_STRLIBNAME, luaopen_string},
   {LUA_MATHLIBNAME, luaopen_math},
 //  {LUA_UTF8LIBNAME, luaopen_utf8},
-//  {LUA_DBLIBNAME, luaopen_debug},
+  {LUA_DBLIBNAME, luaopen_debug},
 #if defined(LUA_COMPAT_BITLIB)
   {LUA_BITLIBNAME, luaopen_bit32},
 #endif