__type
This commit is contained in:
@@ -120,7 +120,8 @@ void Enum::SetMetatable( lua_State *L, LuaReference &EnumTable, LuaReference &En
|
|||||||
lua_setfield( L, -2, "__index" );
|
lua_setfield( L, -2, "__index" );
|
||||||
|
|
||||||
lua_pushliteral( L, "Enum" );
|
lua_pushliteral( L, "Enum" );
|
||||||
lua_setfield( L, -2, "type" );
|
LuaHelpers::PushValueFunc( L, 1 );
|
||||||
|
lua_setfield( L, -2, "__type" ); // for luaL_pushtype
|
||||||
}
|
}
|
||||||
lua_setmetatable( L, -2 );
|
lua_setmetatable( L, -2 );
|
||||||
lua_pop( L, 1 );
|
lua_pop( L, 1 );
|
||||||
|
|||||||
@@ -112,6 +112,10 @@ void LuaBinding::Register( lua_State *L )
|
|||||||
lua_pushstring( L, GetClassName() );
|
lua_pushstring( L, GetClassName() );
|
||||||
lua_setfield( L, metatable, "type" );
|
lua_setfield( L, metatable, "type" );
|
||||||
|
|
||||||
|
lua_pushstring( L, GetClassName() );
|
||||||
|
LuaHelpers::PushValueFunc( L, 1 );
|
||||||
|
lua_setfield( L, metatable, "__type" ); // for luaL_pushtype
|
||||||
|
|
||||||
{
|
{
|
||||||
lua_newtable( L );
|
lua_newtable( L );
|
||||||
int iHeirarchyTable = lua_gettop( L );
|
int iHeirarchyTable = lua_gettop( L );
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ XNode *LuaManager::GetLuaInformation() const
|
|||||||
// fall through
|
// fall through
|
||||||
case LUA_TUSERDATA: // table or userdata: class instance
|
case LUA_TUSERDATA: // table or userdata: class instance
|
||||||
{
|
{
|
||||||
if( !luaL_getmetafield(L, -1, "type") )
|
if( !luaL_callmeta(L, -1, "__type") )
|
||||||
break;
|
break;
|
||||||
RString sType;
|
RString sType;
|
||||||
if( !LuaHelpers::Pop(L, sType) )
|
if( !LuaHelpers::Pop(L, sType) )
|
||||||
|
|||||||
Reference in New Issue
Block a user