LuaHelpers::RunAtExpressionS

LuaManager::ResetState, LuaHelpers::RunScriptFile locking
This commit is contained in:
Glenn Maynard
2005-06-16 22:17:45 +00:00
parent c0a65b3503
commit 9a50b17b9d
5 changed files with 11 additions and 7 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ Actor* ActorUtil::LoadFromActorFile( const CString& sAniDir, const XNode* pNode
}
LUA->RunAtExpressionS( sFile );
LuaHelpers::RunAtExpressionS( sFile );
bool bIsAbsolutePath = sFile.Left(1) == "/";
FixSlashesInPlace( sFile );
+1 -1
View File
@@ -34,7 +34,7 @@ Command::Arg Command::GetArg( unsigned index ) const
Command::Arg::operator CString ()
{
CString sValue = s;
LUA->RunAtExpressionS( sValue );
LuaHelpers::RunAtExpressionS( sValue );
return sValue;
}
+5 -1
View File
@@ -192,6 +192,8 @@ void LuaManager::RegisterTypes()
void LuaManager::ResetState()
{
m_pLock->Lock();
if( L != NULL )
{
LuaReference::BeforeResetAll();
@@ -213,6 +215,8 @@ void LuaManager::ResetState()
RegisterTypes();
LuaReference::AfterResetAll();
m_pLock->Unlock();
}
void LuaManager::PrepareExpression( CString &sInOut )
@@ -370,7 +374,7 @@ bool LuaHelpers::RunExpressionS( const CString &str, CString &sOut )
return true;
}
bool LuaManager::RunAtExpressionS( CString &sStr )
bool LuaHelpers::RunAtExpressionS( CString &sStr )
{
if( sStr.size() == 0 || sStr[0] != '@' )
return false;
+3 -3
View File
@@ -59,9 +59,6 @@ public:
/* Reset the environment, freeing any globals left over by previously executed scripts. */
void ResetState();
/* If sStr begins with @, evaluate the rest as an expression and store the result over sStr. */
bool RunAtExpressionS( CString &sStr );
void SetGlobal( const CString &sName, int val );
void SetGlobal( const CString &sName, bool val );
void SetGlobal( const CString &sName, const CString &val );
@@ -102,6 +99,9 @@ namespace LuaHelpers
int RunExpressionI( const CString &str );
bool RunExpressionS( const CString &str, CString &sOut );
/* If sStr begins with @, evaluate the rest as an expression and store the result over sStr. */
bool RunAtExpressionS( CString &sStr );
template<class T>
void ReadArrayFromTable( vector<T> &aOut, lua_State *L )
{
+1 -1
View File
@@ -698,7 +698,7 @@ void ThemeManager::EvaluateString( CString &sText )
{
/* If the string begins with an @, treat it as a Lua expression.
* Still do font aliases on the resulting string. */
LUA->RunAtExpressionS( sText );
LuaHelpers::RunAtExpressionS( sText );
// "::" means newline since you can't use line breaks in an ini file.
// XXX: this makes it impossible to put a colon at the end of a line, eg: "Color:\nRed"