diff options
author | bloodstalker <thabogre@gmail.com> | 2018-08-15 12:18:29 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-08-15 12:18:29 +0000 |
commit | 98df4cfe8bb9a117f8fc1acb4f3d517e44487600 (patch) | |
tree | 0efef8521ee3eda37530b1b2e6e705707e99f9f2 /luatablegen.py | |
parent | update (diff) | |
download | luatablegen-98df4cfe8bb9a117f8fc1acb4f3d517e44487600.tar.gz luatablegen-98df4cfe8bb9a117f8fc1acb4f3d517e44487600.zip |
update
Diffstat (limited to 'luatablegen.py')
-rwxr-xr-x | luatablegen.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/luatablegen.py b/luatablegen.py index b2542ff..4921e5f 100755 --- a/luatablegen.py +++ b/luatablegen.py @@ -65,14 +65,15 @@ SOURCE_FILE_NAME='XXX_luatablegen.c' HEADER_FILE_NAME='XXX_luatablegen.h' LUA_PUSH_TABLE = """ int pushluatable_YYY(lua_State* ls, XXX array) { - lua_newtable(ls); - if (!lua_checkstack(ls, count+1)) { + if (!lua_checkstack(ls, 2)) { printf("Not enough space on the lua stack."); return -1; } + lua_newtable(ls); for (int i = 0; i < count; ++i) { lua_pushinteger(i+1); - push_self_ZZZ(ls, array[i]); + WWW_push_args(ls, array[i]); + new_WWW(ls); lua_settable(ls, -3); } return 0; @@ -525,7 +526,8 @@ class TbgParser(object): else: xxx = node.attrib["name"] zzz = "lua_push" + node.attrib["luatype"] - tbl_source.write(LUA_PUSH_TABLE.replace("XXX", xxx+pointer).replace("YYY", xxx)) + if pointer == "*": continue + tbl_source.write(LUA_PUSH_TABLE.replace("XXX", xxx+pointer).replace("YYY", xxx).replace("WWW", xxx)) tbl_header.write(LUA_PUSH_TABLE_SIG.replace("XXX", xxx+pointer).replace("YYY", xxx)) #end of tadldef |