summaryrefslogtreecommitdiff
path: root/library/LuaTypes.cpp
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-05-03 11:47:04 +0400
committerAlexander Gavrilov2012-05-03 11:47:04 +0400
commit5afe2ca0020404d46ad3de840030a7b9e186b059 (patch)
tree7066712fd0d5cae9ea766189b788efc1c69ae9ad /library/LuaTypes.cpp
parent28b5068382ebd406b269e6b4aeb073e7cd26503e (diff)
downloaddfhack-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.cpp27
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());
}
}