diff options
| author | Alexander Gavrilov | 2012-05-03 11:47:04 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-05-03 11:47:04 +0400 |
| commit | 5afe2ca0020404d46ad3de840030a7b9e186b059 (patch) | |
| tree | 7066712fd0d5cae9ea766189b788efc1c69ae9ad /library/LuaTypes.cpp | |
| parent | 28b5068382ebd406b269e6b4aeb073e7cd26503e (diff) | |
| download | dfhack-5afe2ca0020404d46ad3de840030a7b9e186b059.tar.gz dfhack-5afe2ca0020404d46ad3de840030a7b9e186b059.tar.bz2 dfhack-5afe2ca0020404d46ad3de840030a7b9e186b059.tar.xz | |
Update dfhack for specific_ref.
Diffstat (limited to 'library/LuaTypes.cpp')
| -rw-r--r-- | library/LuaTypes.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/library/LuaTypes.cpp b/library/LuaTypes.cpp index 02a89f9e..c58c25d1 100644 --- a/library/LuaTypes.cpp +++ b/library/LuaTypes.cpp @@ -1103,26 +1103,39 @@ static void IndexFields(lua_State *state, int base, struct_identity *pstruct, bo name = pstruct->getName() + ("." + name); lua_pop(state, 1); + bool add_to_enum = true; + // Handle the field switch (fields[i].mode) { case struct_field_info::OBJ_METHOD: AddMethodWrapper(state, base+1, base+2, name.c_str(), (function_identity_base*)fields[i].type); - break; + continue; case struct_field_info::CLASS_METHOD: + continue; + + case struct_field_info::POINTER: + // Skip class-typed pointers within unions + if ((fields[i].count & 2) != 0 && fields[i].type && + fields[i].type->type() == IDTYPE_CLASS) + add_to_enum = false; break; default: - // Do not add invalid globals to the enumeration order - if (!globals || *(void**)fields[i].offset) - AssociateId(state, base+3, ++cnt, name.c_str()); - - lua_pushlightuserdata(state, (void*)&fields[i]); - lua_setfield(state, base+2, name.c_str()); break; } + + // Do not add invalid globals to the enumeration order + if (globals && !*(void**)fields[i].offset) + add_to_enum = false; + + if (add_to_enum) + AssociateId(state, base+3, ++cnt, name.c_str()); + + lua_pushlightuserdata(state, (void*)&fields[i]); + lua_setfield(state, base+2, name.c_str()); } } |
