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) == "/";
|
bool bIsAbsolutePath = sFile.Left(1) == "/";
|
||||||
FixSlashesInPlace( sFile );
|
FixSlashesInPlace( sFile );
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ Command::Arg Command::GetArg( unsigned index ) const
|
|||||||
Command::Arg::operator CString ()
|
Command::Arg::operator CString ()
|
||||||
{
|
{
|
||||||
CString sValue = s;
|
CString sValue = s;
|
||||||
LUA->RunAtExpressionS( sValue );
|
LuaHelpers::RunAtExpressionS( sValue );
|
||||||
return sValue;
|
return sValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,6 +192,8 @@ void LuaManager::RegisterTypes()
|
|||||||
|
|
||||||
void LuaManager::ResetState()
|
void LuaManager::ResetState()
|
||||||
{
|
{
|
||||||
|
m_pLock->Lock();
|
||||||
|
|
||||||
if( L != NULL )
|
if( L != NULL )
|
||||||
{
|
{
|
||||||
LuaReference::BeforeResetAll();
|
LuaReference::BeforeResetAll();
|
||||||
@@ -213,6 +215,8 @@ void LuaManager::ResetState()
|
|||||||
RegisterTypes();
|
RegisterTypes();
|
||||||
|
|
||||||
LuaReference::AfterResetAll();
|
LuaReference::AfterResetAll();
|
||||||
|
|
||||||
|
m_pLock->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaManager::PrepareExpression( CString &sInOut )
|
void LuaManager::PrepareExpression( CString &sInOut )
|
||||||
@@ -370,7 +374,7 @@ bool LuaHelpers::RunExpressionS( const CString &str, CString &sOut )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LuaManager::RunAtExpressionS( CString &sStr )
|
bool LuaHelpers::RunAtExpressionS( CString &sStr )
|
||||||
{
|
{
|
||||||
if( sStr.size() == 0 || sStr[0] != '@' )
|
if( sStr.size() == 0 || sStr[0] != '@' )
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -59,9 +59,6 @@ public:
|
|||||||
/* Reset the environment, freeing any globals left over by previously executed scripts. */
|
/* Reset the environment, freeing any globals left over by previously executed scripts. */
|
||||||
void ResetState();
|
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, int val );
|
||||||
void SetGlobal( const CString &sName, bool val );
|
void SetGlobal( const CString &sName, bool val );
|
||||||
void SetGlobal( const CString &sName, const CString &val );
|
void SetGlobal( const CString &sName, const CString &val );
|
||||||
@@ -102,6 +99,9 @@ namespace LuaHelpers
|
|||||||
int RunExpressionI( const CString &str );
|
int RunExpressionI( const CString &str );
|
||||||
bool RunExpressionS( const CString &str, CString &sOut );
|
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>
|
template<class T>
|
||||||
void ReadArrayFromTable( vector<T> &aOut, lua_State *L )
|
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.
|
/* If the string begins with an @, treat it as a Lua expression.
|
||||||
* Still do font aliases on the resulting string. */
|
* 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.
|
// "::" 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"
|
// 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