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:
Kyzentun
2014-07-05 01:34:05 -06:00
committed by Jonathan Payne
parent cd1292dd18
commit 95fe1a17e9
18 changed files with 219 additions and 168 deletions
+5 -6
View File
@@ -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