aboutsummaryrefslogtreecommitdiffstats
path: root/luatablegen.py
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-09-24 16:58:52 +0000
committerbloodstalker <thabogre@gmail.com>2018-09-24 16:58:52 +0000
commit30eef04fc16244e124421d3b89ee67c606449805 (patch)
tree795620ba8c8de7d8cebecec5044e45d3e12211dd /luatablegen.py
parentfix (diff)
downloadluatablegen-30eef04fc16244e124421d3b89ee67c606449805.tar.gz
luatablegen-30eef04fc16244e124421d3b89ee67c606449805.zip
fix
Diffstat (limited to 'luatablegen.py')
-rwxr-xr-xluatablegen.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/luatablegen.py b/luatablegen.py
index ae75733..3a9cf2b 100755
--- a/luatablegen.py
+++ b/luatablegen.py
@@ -465,6 +465,23 @@ class TbgParser(object):
c_source.write("\n")
def check(self, c_source, struct_name):
+ #print(struct_name)
+ node = get_def_node(struct_name, self.elems)
+ #print(node.attrib["name"])
+ has_conditional = False
+ for elem in node:
+ if node.attrib["name"] == "W_Import_Section_Entry": print(elem.tag)
+ if "conditional" in elem.attrib:
+ has_conditional = True
+ print("fuck yeah")
+ if has_conditional == True:
+ print("here")
+ c_source.write('static XXX* check_XXX(lua_State* __ls, int index) {\n'.replace("XXX", struct_name))
+ c_source.write('\tXXX* dummy;\n'.replace("XXX", struct_name))
+ c_source.write('dummy = lua_touserdata(__ls, index);\n'.replace("XXX", struct_name))
+ c_source.write('\tif (dummy == NULL) printf("XXX:bad user data type.\\n");\n'.replace("XXX", struct_name))
+ c_source.write('\treturn dummy;\n}\n')
+ return
for line in CHECK:
c_source.write(line.replace("XXX", struct_name))
c_source.write("\n")