add GetChildren
This commit is contained in:
@@ -236,6 +236,17 @@ void ActorFrame::EndDraw()
|
||||
Actor::EndDraw();
|
||||
}
|
||||
|
||||
void ActorFrame::PushChildrenTable( lua_State *L )
|
||||
{
|
||||
lua_newtable( L );
|
||||
FOREACH( Actor*, m_SubActors, a )
|
||||
{
|
||||
LuaHelpers::Push( L, (*a)->GetName() );
|
||||
(*a)->PushSelf( L );
|
||||
lua_rawset( L, -3 );
|
||||
}
|
||||
}
|
||||
|
||||
void ActorFrame::PlayCommandOnChildren( const RString &sCommandName, const LuaReference *pParamTable )
|
||||
{
|
||||
const apActorCommands *pCmd = GetCommand( sCommandName );
|
||||
@@ -405,6 +416,11 @@ public:
|
||||
lua_pushnil( L );
|
||||
return 1;
|
||||
}
|
||||
static int GetChildren( T* p, lua_State *L )
|
||||
{
|
||||
p->PushChildrenTable( L );
|
||||
return 1;
|
||||
}
|
||||
static int GetNumChildren( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumChildren() ); return 1; }
|
||||
static int SetDrawByZPosition( T* p, lua_State *L ) { p->SetDrawByZPosition( BArg(1) ); return 1; }
|
||||
|
||||
@@ -419,6 +435,7 @@ public:
|
||||
ADD_METHOD( SetFOV );
|
||||
ADD_METHOD( vanishpoint );
|
||||
ADD_METHOD( GetChild );
|
||||
ADD_METHOD( GetChildren );
|
||||
ADD_METHOD( GetNumChildren );
|
||||
ADD_METHOD( SetDrawByZPosition );
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public:
|
||||
// Commands
|
||||
//
|
||||
virtual void PushSelf( lua_State *L );
|
||||
void PushChildrenTable( lua_State *L );
|
||||
void PlayCommandOnChildren( const RString &sCommandName, const LuaReference *pParamTable = NULL );
|
||||
void PlayCommandOnLeaves( const RString &sCommandName, const LuaReference *pParamTable = NULL );
|
||||
virtual void RunCommandsOnChildren( const LuaReference& cmds, const LuaReference *pParamTable = NULL ); /* but not on self */
|
||||
|
||||
Reference in New Issue
Block a user