From 49968b6a896cf5dc76c93e5983ef2185a97c44a8 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Wed, 29 Aug 2018 22:58:29 +0430 Subject: update --- luatablegen.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/luatablegen.py b/luatablegen.py index 01fcfe5..ed1fe15 100755 --- a/luatablegen.py +++ b/luatablegen.py @@ -52,18 +52,14 @@ REGISTER_META = ['static const luaL_Reg XXX_meta[] = {\n', TABLE_REGISTER = ['int XXX_register(lua_State* __ls) {\n', 'lua_newtable(__ls);\n', 'luaL_setfuncs(__ls, XXX_methods, 0);\n', - 'lua_setglobal(__ls, "XXX");\n', - '\tluaL_newmetatable(__ls, "XXX");\n', - 'lua_newtable(__ls);\n', + 'luaL_newmetatable(__ls, "XXX");\n', 'luaL_setfuncs(__ls, XXX_meta, 0);\n', - 'lua_setglobal(__ls, 0);\n', - '\tlua_pushliteral(__ls, "__index");\n', - '\tlua_pushvalue(__ls, -3);\n', - '\tlua_rawset(__ls, -3);\n', - '\tlua_pushliteral(__ls, "__metatable");\n', - '\tlua_pushvalue(__ls, -3);\n', - '\tlua_rawset(__ls, -3);\n', - '\tlua_pop(__ls, 1);\n', + 'lua_pushliteral(__ls, "__index");\n', + 'lua_pushvalue(__ls, -3);\n', + 'lua_rawset(__ls, -3);\n', + 'lua_pushliteral(__ls, "__metatable");\n', + 'lua_pushvalue(__ls, -3);\n', + 'lua_rawset(__ls, -3);\n', 'return 1;\n}\n'] SOURCE_FILE_NAME='XXX_luatablegen.c' HEADER_FILE_NAME='XXX_luatablegen.h' -- cgit v1.2.3