more useful error messages

This commit is contained in:
Glenn Maynard
2006-09-29 07:24:40 +00:00
parent 63cb157197
commit 85eb3e0a05
3 changed files with 9 additions and 8 deletions
+4 -4
View File
@@ -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; RString sLuaFunction;
if( sCommands.size() > 0 && sCommands[0] == '\033' ) if( sCommands.size() > 0 && sCommands[0] == '\033' )
@@ -472,16 +472,16 @@ void ActorUtil::ParseActorCommands( Lua *L, const RString &sCommands )
} }
RString sError; 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() ); LOG->Warn( "Compiling \"%s\": %s", sLuaFunction.c_str(), sError.c_str() );
/* The function is now on the stack. */ /* 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(); Lua *L = LUA->Get();
ParseActorCommands( L, sCommands ); ParseActorCommands( L, sCommands, sName );
LuaReference *pRet = new LuaReference; LuaReference *pRet = new LuaReference;
pRet->SetFromStack( L ); pRet->SetFromStack( L );
LUA->Release( L ); LUA->Release( L );
+2 -2
View File
@@ -45,8 +45,8 @@ namespace ActorUtil
void Register( const RString& sClassName, CreateActorFn pfn ); void Register( const RString& sClassName, CreateActorFn pfn );
Actor* Create( const RString& sClassName, const RString& sDir, const XNode* pNode, Actor *pParentActor ); Actor* Create( const RString& sClassName, const RString& sDir, const XNode* pNode, Actor *pParentActor );
void ParseActorCommands( Lua *L, const RString &sCommands ); void ParseActorCommands( Lua *L, const RString &sCommands, const RString &sName = "" );
apActorCommands ParseActorCommands( const RString &sCommands ); apActorCommands ParseActorCommands( const RString &sCommands, const RString &sName = "" );
void SetXY( Actor& actor, const RString &sType ); void SetXY( Actor& actor, const RString &sType );
void LoadCommand( Actor& actor, const RString &sType, const RString &sCommandName ); void LoadCommand( Actor& actor, const RString &sType, const RString &sCommandName );
void LoadCommandFromName( Actor& actor, const RString &sType, const RString &sCommandName, const RString &sName ); void LoadCommandFromName( Actor& actor, const RString &sType, const RString &sCommandName, const RString &sName );
+3 -2
View File
@@ -949,14 +949,15 @@ void ThemeManager::PushMetric( Lua *L, const RString &sClassName, const RString
{ {
RString sValue = GetMetricRaw( g_pLoadedThemeData->iniMetrics, sClassName, sValueName ); RString sValue = GetMetricRaw( g_pLoadedThemeData->iniMetrics, sClassName, sValueName );
RString sName = ssprintf( "%s::%s", sClassName.c_str(), sValueName.c_str() );
if( EndsWith(sValueName, "Command") ) if( EndsWith(sValueName, "Command") )
{ {
ActorUtil::ParseActorCommands( L, sValue ); ActorUtil::ParseActorCommands( L, sValue, sName );
} }
else else
{ {
LuaHelpers::PrepareExpression( sValue ); LuaHelpers::PrepareExpression( sValue );
LuaHelpers::RunExpression( L, sValue, ssprintf("%s::%s", sClassName.c_str(), sValueName.c_str()) ); LuaHelpers::RunExpression( L, sValue, sName );
} }
} }