LuaHelpers::RunAtExpressionS
LuaManager::ResetState, LuaHelpers::RunScriptFile locking
This commit is contained in:
@@ -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 );
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user