more useful error messages
This commit is contained in:
@@ -396,7 +396,7 @@ Actor* ActorUtil::MakeActor( const RString &sPath_, const XNode *pParent, Actor
|
||||
}
|
||||
}
|
||||
|
||||
void ActorUtil::ParseActorCommands( Lua *L, const RString &sCommands )
|
||||
void ActorUtil::ParseActorCommands( Lua *L, const RString &sCommands, const RString &sName )
|
||||
{
|
||||
RString sLuaFunction;
|
||||
if( sCommands.size() > 0 && sCommands[0] == '\033' )
|
||||
@@ -472,16 +472,16 @@ void ActorUtil::ParseActorCommands( Lua *L, const RString &sCommands )
|
||||
}
|
||||
|
||||
RString sError;
|
||||
if( !LuaHelpers::RunScript( L, sLuaFunction, "", sError, 1 ) )
|
||||
if( !LuaHelpers::RunScript( L, sLuaFunction, sName, sError, 1 ) )
|
||||
LOG->Warn( "Compiling \"%s\": %s", sLuaFunction.c_str(), sError.c_str() );
|
||||
|
||||
/* The function is now on the stack. */
|
||||
}
|
||||
|
||||
apActorCommands ActorUtil::ParseActorCommands( const RString &sCommands )
|
||||
apActorCommands ActorUtil::ParseActorCommands( const RString &sCommands, const RString &sName )
|
||||
{
|
||||
Lua *L = LUA->Get();
|
||||
ParseActorCommands( L, sCommands );
|
||||
ParseActorCommands( L, sCommands, sName );
|
||||
LuaReference *pRet = new LuaReference;
|
||||
pRet->SetFromStack( L );
|
||||
LUA->Release( L );
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace ActorUtil
|
||||
void Register( const RString& sClassName, CreateActorFn pfn );
|
||||
Actor* Create( const RString& sClassName, const RString& sDir, const XNode* pNode, Actor *pParentActor );
|
||||
|
||||
void ParseActorCommands( Lua *L, const RString &sCommands );
|
||||
apActorCommands ParseActorCommands( const RString &sCommands );
|
||||
void ParseActorCommands( Lua *L, const RString &sCommands, const RString &sName = "" );
|
||||
apActorCommands ParseActorCommands( const RString &sCommands, const RString &sName = "" );
|
||||
void SetXY( Actor& actor, const RString &sType );
|
||||
void LoadCommand( Actor& actor, const RString &sType, const RString &sCommandName );
|
||||
void LoadCommandFromName( Actor& actor, const RString &sType, const RString &sCommandName, const RString &sName );
|
||||
|
||||
@@ -949,14 +949,15 @@ void ThemeManager::PushMetric( Lua *L, const RString &sClassName, const RString
|
||||
{
|
||||
RString sValue = GetMetricRaw( g_pLoadedThemeData->iniMetrics, sClassName, sValueName );
|
||||
|
||||
RString sName = ssprintf( "%s::%s", sClassName.c_str(), sValueName.c_str() );
|
||||
if( EndsWith(sValueName, "Command") )
|
||||
{
|
||||
ActorUtil::ParseActorCommands( L, sValue );
|
||||
ActorUtil::ParseActorCommands( L, sValue, sName );
|
||||
}
|
||||
else
|
||||
{
|
||||
LuaHelpers::PrepareExpression( sValue );
|
||||
LuaHelpers::RunExpression( L, sValue, ssprintf("%s::%s", sClassName.c_str(), sValueName.c_str()) );
|
||||
LuaHelpers::RunExpression( L, sValue, sName );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user