aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-09-10 03:39:11 +0000
committerbloodstalker <thabogre@gmail.com>2018-09-10 03:39:11 +0000
commit9471fdb9bc3aff3c1ab573e45a8d7ac5da2d2536 (patch)
treedc2d7d10e543e1d258cee6e8554c86b9268c2dc0
parentupdate (diff)
downloadluatablegen-9471fdb9bc3aff3c1ab573e45a8d7ac5da2d2536.tar.gz
luatablegen-9471fdb9bc3aff3c1ab573e45a8d7ac5da2d2536.zip
update
Diffstat (limited to '')
-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 = """