aboutsummaryrefslogtreecommitdiffstats
path: root/luatablegen.py
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2019-01-21 10:27:59 +0000
committerbloodstalker <thabogre@gmail.com>2019-01-21 10:27:59 +0000
commit4e1ea95b5e599c765fa8f3c634730ff9c9bd6ecf (patch)
tree66447bc64649c62bb074114a0ba8f2d5fda5a7ed /luatablegen.py
parentupdate (diff)
downloadluatablegen-4e1ea95b5e599c765fa8f3c634730ff9c9bd6ecf.tar.gz
luatablegen-4e1ea95b5e599c765fa8f3c634730ff9c9bd6ecf.zip
update
Diffstat (limited to '')
-rwxr-xr-xluatablegen.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/luatablegen.py b/luatablegen.py
index c25b243..bfd0248 100755
--- a/luatablegen.py
+++ b/luatablegen.py
@@ -672,7 +672,10 @@ class TbgParser(object):
dummy = str()
rev_counter = -len(field_types)
c_source.write(NEW[0].replace("XXX", struct_name))
- c_source.write("\tlua_checkstack(__ls, " + repr(len(field_names)) + ");\n")
+ if not field_names:
+ c_source.write("\tlua_checkstack(__ls, 1);\n")
+ else:
+ c_source.write("\tlua_checkstack(__ls, " + repr(len(field_names)) + ");\n")
if not field_names:
orig_node = get_def_node(struct_name, self.elems)
lua_type = orig_node.attrib["luatype"]
@@ -733,7 +736,10 @@ class TbgParser(object):
rev_counter += 1
c_source.write(dummy)
dummy = str()
- c_source.write("lua_pop(__ls,"+repr(len(field_types))+");\n")
+ if not field_names:
+ c_source.write("lua_pop(__ls,1);\n")
+ else:
+ c_source.write("lua_pop(__ls,"+repr(len(field_types))+");\n")
c_source.write(NEW[2].replace("XXX", struct_name))
for field_name in field_names:
c_source.write("\tdummy->" + field_name + " = " + field_name + ";\n")