Replaced every use of lua_call with RunScriptOnStack. Modified RunScriptOnStack to report an error to log and system message using a passed in context string. Modified every use of RunScriptOnStack to avoid crashing so that the reported error can be seen.
This commit is contained in:
@@ -194,17 +194,16 @@ void ScreenWithMenuElements::StartPlayingMusic()
|
||||
*/
|
||||
if( ft == FT_Lua )
|
||||
{
|
||||
RString sScript;
|
||||
RString sError;
|
||||
if( GetFileContents(m_sPathToMusic, sScript) )
|
||||
RString Script;
|
||||
RString Error= "Lua runtime error: ";
|
||||
if( GetFileContents(m_sPathToMusic, Script) )
|
||||
{
|
||||
Lua *L = LUA->Get();
|
||||
|
||||
if( !LuaHelpers::RunScript(L, sScript, "@"+m_sPathToMusic, sError, 0, 1) )
|
||||
if( !LuaHelpers::RunScript(L, Script, "@"+m_sPathToMusic, Error, 0, 1, true) )
|
||||
{
|
||||
LUA->Release( L );
|
||||
sError = ssprintf( "Lua runtime error: %s", sError.c_str() );
|
||||
Dialog::OK( sError, "LUA_ERROR" );
|
||||
Dialog::OK( Error, "LUA_ERROR" );
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user