diff options
author | bloodstalker <thabogre@gmail.com> | 2018-12-31 22:43:03 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-12-31 22:43:03 +0000 |
commit | 841a338c1bb5fb96ea60a6cedc7081a2e5cb57d3 (patch) | |
tree | 9003c550f19cb3c5cd5a9d634071438eb2e0d3be | |
parent | update (diff) | |
download | luatablegen-841a338c1bb5fb96ea60a6cedc7081a2e5cb57d3.tar.gz luatablegen-841a338c1bb5fb96ea60a6cedc7081a2e5cb57d3.zip |
fix
-rwxr-xr-x | luatablegen.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/luatablegen.py b/luatablegen.py index 9bc87c8..e5d9b31 100755 --- a/luatablegen.py +++ b/luatablegen.py @@ -750,8 +750,12 @@ class TbgParser(object): dummy += "for (uint64_t i = 0; i < dummy->" + count_replacer + " ; ++i) {\nlua_pushinteger(__ls, i+1);\n" if ref_node_type != None: dummy += "if (dummy->" +field_name+ "[i] != NULL) {\n" - dummy += ref_node_type.attrib["name"]+ "_push_args(__ls, dummy->"+field_name+"[i]);\n"+"} else {\nlua_pop(__ls, 1);\n continue;\n}" - dummy += "new_" + ref_node_type.attrib["name"] + "(__ls);\n" + #dummy += ref_node_type.attrib["name"]+ "_push_args(__ls, dummy->"+field_name+"[i]);\n"+"} else {\nlua_pop(__ls, 1);\n continue;\n}" + #dummy += "new_" + ref_node_type.attrib["name"] + "(__ls);\n" + dummy += "lua_pushlightuserdata(__ls, dummy->"+field_name+"[i]);\n" + dummy += 'luaL_getmetatable(__ls,"'+ref_node_type.attrib["name"]+'");\n' + dummy += "lua_setmetatable(__ls, -2);\n" + dummy += "} else {\nlua_pop(__ls, 1);\n continue;\n}" else: eq_lua_type = get_eq_lua_type(field_type) dummy += "lua_push"+eq_lua_type+"(__ls, dummy->"+field_name+"[i]);\n" @@ -862,8 +866,9 @@ class TbgParser(object): # FIXME- not implemented for count greater than one else: dummy = "if (!lua_checkstack(__ls, 3)) {printf(\"error\"\n);return 0;}\n" - dummy += "int table_length = lua_rawlen(__ls, 2);\nfree(dummy->"+field_name+");\n" - dummy += "dummy->" +field_name+ "=calloc(sizeof(" +type_replacement+ ")*table_length,1);\n" + dummy += "int table_length = lua_rawlen(__ls, 2);\n" + #dummy += "free(dummy->"+field_name+");\n" + #dummy += "dummy->" +field_name+ "=calloc(sizeof(" +type_replacement+ ")*table_length,1);\n" dummy += "for (int i = 1; i <= table_length; ++i) {\n lua_rawgeti(__ls, 2, i);\n" real_type = node.attrib["type"] real_type_string = lua_type_resolver(real_type) |