aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xluatablegen.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/luatablegen.py b/luatablegen.py
index d1b4a9c..9fe7a3b 100755
--- a/luatablegen.py
+++ b/luatablegen.py
@@ -49,11 +49,12 @@ REGISTER_TABLE_METHODS = ['static const luaL_Reg XXX_methods[] = {\n',
'\t{0,0}\n};\n']
REGISTER_META = ['static const luaL_Reg XXX_meta[] = {\n',
'\t{0, 0}\n};\n']
-# table register function for anonymous lua tables
-TABLE_REGISTER = ['int XXX_register(lua_State* __ls) {\n',
+# table register for global lua tables
+TABLE_REGISTER_G = ['int XXX_register(lua_State* __ls) {\n',
'lua_checkstack(__ls, 4);\n'
'lua_newtable(__ls);\n',
'luaL_setfuncs(__ls, XXX_methods, 0);\n',
+ 'lua_setglobal(__ls, "XXX");\n',
'luaL_newmetatable(__ls, "XXX");\n',
'luaL_setfuncs(__ls, XXX_meta, 0);\n',
'lua_pushliteral(__ls, "__index");\n',
@@ -64,8 +65,8 @@ TABLE_REGISTER = ['int XXX_register(lua_State* __ls) {\n',
'lua_rawset(__ls, -3);\n',
'lua_setglobal(__ls , "XXX");\n'
'return 0;\n}\n']
-# table register for global lua tables
-TABLE_REGISTER_G = ['int XXX_register(lua_State* __ls) {\n',
+# table register function for anonymous lua tables
+TABLE_REGISTER = ['int XXX_register(lua_State* __ls) {\n',
'lua_checkstack(__ls, 4);\n'
'lua_newtable(__ls);\n',
'luaL_setfuncs(__ls, XXX_methods, 0);\n',
@@ -78,7 +79,7 @@ TABLE_REGISTER_G = ['int XXX_register(lua_State* __ls) {\n',
'lua_pushvalue(__ls, -3);\n',
'lua_rawset(__ls, -3);\n',
'lua_setglobal(__ls , "XXX");\n'
- 'return 1;\n}\n']
+ 'return 0;\n}\n']
SOURCE_FILE_NAME='XXX_luatablegen.c'
HEADER_FILE_NAME='XXX_luatablegen.h'
LUA_PUSH_TABLE = """