diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 573e9d2073..181553dc1e 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -52,12 +52,12 @@ void ActorFrame::LoadFromNode( const CString& sDir, const XNode* pNode ) CString s; if( pNode->GetAttrValue( "VanishX", s ) ) { - LUA->PrepareExpression( s ); + LuaHelpers::PrepareExpression( s ); m_fVanishX = LuaHelpers::RunExpressionF( s ); } if( pNode->GetAttrValue( "VanishY", s ) ) { - LUA->PrepareExpression( s ); + LuaHelpers::PrepareExpression( s ); m_fVanishY = LuaHelpers::RunExpressionF( s ); } m_bOverrideLighting = pNode->GetAttrValue( "Lighting", m_bLighting ); diff --git a/stepmania/src/Command.cpp b/stepmania/src/Command.cpp index 7f5fab5dd5..484a8b2f20 100644 --- a/stepmania/src/Command.cpp +++ b/stepmania/src/Command.cpp @@ -40,19 +40,19 @@ Command::Arg::operator CString () Command::Arg::operator float () { - LUA->PrepareExpression( s ); // strip invalid chars + LuaHelpers::PrepareExpression( s ); // strip invalid chars return LuaHelpers::RunExpressionF( s ); } Command::Arg::operator int () { - LUA->PrepareExpression( s ); // strip invalid chars + LuaHelpers::PrepareExpression( s ); // strip invalid chars return (int) LuaHelpers::RunExpressionF( s ); } Command::Arg::operator bool () { - LUA->PrepareExpression( s ); // strip invalid chars + LuaHelpers::PrepareExpression( s ); // strip invalid chars return LuaHelpers::RunExpressionF( s ) != 0.0f; } diff --git a/stepmania/src/LuaManager.cpp b/stepmania/src/LuaManager.cpp index f2b6567538..c74129917c 100644 --- a/stepmania/src/LuaManager.cpp +++ b/stepmania/src/LuaManager.cpp @@ -227,7 +227,7 @@ void LuaManager::ResetState() m_pLock->Unlock(); } -void LuaManager::PrepareExpression( CString &sInOut ) +void LuaHelpers::PrepareExpression( CString &sInOut ) { // HACK: Many metrics have "//" comments that Lua fails to parse. // Replace them with Lua-style comments. diff --git a/stepmania/src/LuaManager.h b/stepmania/src/LuaManager.h index adb17124c1..83eddfa752 100644 --- a/stepmania/src/LuaManager.h +++ b/stepmania/src/LuaManager.h @@ -54,8 +54,6 @@ public: Lua *Get(); void Release( Lua *&p ); - void PrepareExpression( CString &sInOut ); // strip "//" comments and "+" - /* Reset the environment, freeing any globals left over by previously executed scripts. */ void ResetState(); @@ -86,6 +84,9 @@ namespace LuaHelpers bool RunScriptFile( const CString &sFile ); + /* Strip "//" comments and "+". */ + void PrepareExpression( CString &sInOut ); + /* Create a Lua array (a table with indices starting at 1) of the given vector, * and push it on the stack. */ void CreateTableFromArrayB( Lua *L, const vector &aIn ); diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index c874e9f46e..ca47ac2d95 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -717,7 +717,7 @@ float ThemeManager::GetMetricF( const CString &sClassName, const CString &sValue { CString sValue = GetMetric( sClassName, sValueName ); // Use non-raw so that Lua expressions are allowed - LUA->PrepareExpression( sValue ); + LuaHelpers::PrepareExpression( sValue ); return LuaHelpers::RunExpressionF( sValue ); } @@ -737,7 +737,7 @@ bool ThemeManager::GetMetricB( const CString &sClassName, const CString &sValueN if( sValue.Left(1) == "1" ) return true; /* optimization */ - LUA->PrepareExpression( sValue ); + LuaHelpers::PrepareExpression( sValue ); return LuaHelpers::RunExpressionB( sValue ); }