check BaseType if parent is not exported
@@ -567,19 +567,32 @@ return index
checkMethodValid(con);
// set parent
- if (parent != null && parent != typeof(object) && parent != typeof(ValueType))
- {
+ bool parentSet = false;
LuaDLL.lua_pushstring(l, "__parent");
+ while (parent != null && parent != typeof(object) && parent != typeof(ValueType))
+ {
LuaDLL.luaL_getmetatable(l, ObjectCache.getAQName(parent));
+ // if parentType is not exported to lua
+ if (LuaDLL.lua_isnil(l, -1))
+ {
+ LuaDLL.lua_pop(l, 1);
+ parent = parent.BaseType;
+ }
+ else
+ {
LuaDLL.lua_rawset(l, -3);
LuaDLL.lua_pushstring(l, "__parent");
LuaDLL.luaL_getmetatable(l, parent.FullName);
LuaDLL.lua_rawset(l, -4);
+
+ parentSet = true;
+ break;
}
- else
+ }
+
+ if(!parentSet)
{
- LuaDLL.lua_pushstring(l, "__parent");
LuaDLL.luaL_getmetatable(l, "__luabaseobject");
LuaDLL.lua_rawset(l, -3);
}
