LuaHelpers::RunScriptFile
This commit is contained in:
@@ -229,7 +229,7 @@ void LuaManager::PrepareExpression( CString &sInOut )
|
|||||||
sInOut.erase( 0, 1 );
|
sInOut.erase( 0, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LuaManager::RunScriptFile( const CString &sFile )
|
bool LuaHelpers::RunScriptFile( const CString &sFile )
|
||||||
{
|
{
|
||||||
RageFile f;
|
RageFile f;
|
||||||
if( !f.Open( sFile ) )
|
if( !f.Open( sFile ) )
|
||||||
@@ -248,7 +248,7 @@ bool LuaManager::RunScriptFile( const CString &sFile )
|
|||||||
}
|
}
|
||||||
|
|
||||||
CString sError;
|
CString sError;
|
||||||
if( !LuaHelpers::RunScript( L, sScript, sFile, sError, 0 ) )
|
if( !LuaHelpers::RunScript( LUA->L, sScript, sFile, sError, 0 ) )
|
||||||
{
|
{
|
||||||
sError = ssprintf( "Lua runtime error: %s", sError.c_str() );
|
sError = ssprintf( "Lua runtime error: %s", sError.c_str() );
|
||||||
Dialog::OK( sError, "LUA_ERROR" );
|
Dialog::OK( sError, "LUA_ERROR" );
|
||||||
|
|||||||
@@ -56,8 +56,6 @@ public:
|
|||||||
|
|
||||||
void PrepareExpression( CString &sInOut ); // strip "//" comments and "+"
|
void PrepareExpression( CString &sInOut ); // strip "//" comments and "+"
|
||||||
|
|
||||||
bool RunScriptFile( const CString &sFile );
|
|
||||||
|
|
||||||
/* 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();
|
||||||
|
|
||||||
@@ -97,6 +95,8 @@ namespace LuaHelpers
|
|||||||
* Returns false on error, with sError set. */
|
* Returns false on error, with sError set. */
|
||||||
bool RunScript( Lua *L, const CString &sScript, const CString &sName, CString &sError, int iReturnValues = 0 );
|
bool RunScript( Lua *L, const CString &sScript, const CString &sName, CString &sError, int iReturnValues = 0 );
|
||||||
|
|
||||||
|
bool RunScriptFile( const CString &sFile );
|
||||||
|
|
||||||
/* Create a Lua array (a table with indices starting at 1) of the given vector,
|
/* Create a Lua array (a table with indices starting at 1) of the given vector,
|
||||||
* and push it on the stack. */
|
* and push it on the stack. */
|
||||||
void CreateTableFromArrayB( Lua *L, const vector<bool> &aIn );
|
void CreateTableFromArrayB( Lua *L, const vector<bool> &aIn );
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ void ThemeManager::RunLuaScripts( const CString &sMask )
|
|||||||
{
|
{
|
||||||
const CString &sPath = asElementPaths[i];
|
const CString &sPath = asElementPaths[i];
|
||||||
LOG->Trace( "Loading \"%s\" ...", sPath.c_str() );
|
LOG->Trace( "Loading \"%s\" ...", sPath.c_str() );
|
||||||
LUA->RunScriptFile( sPath );
|
LuaHelpers::RunScriptFile( sPath );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while( iter != g_vThemes.begin() );
|
while( iter != g_vThemes.begin() );
|
||||||
|
|||||||
Reference in New Issue
Block a user