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:
+4
-6
@@ -846,9 +846,8 @@ void Profile::LoadCustomFunction( RString sDir )
|
||||
LuaHelpers::Push(L, sDir);
|
||||
|
||||
// Run it
|
||||
RString sError;
|
||||
if (!LuaHelpers::RunScriptOnStack(L, sError, 2, 0))
|
||||
LOG->Warn("Error running CustomLoadFunction: %s", sError.c_str());
|
||||
RString Error= "Error running CustomLoadFunction: ";
|
||||
LuaHelpers::RunScriptOnStack(L, Error, 2, 0, true);
|
||||
|
||||
LUA->Release(L);
|
||||
}
|
||||
@@ -1029,9 +1028,8 @@ bool Profile::SaveAllToDir( RString sDir, bool bSignData ) const
|
||||
LuaHelpers::Push(L, sDir);
|
||||
|
||||
// Run it
|
||||
RString sError;
|
||||
if (!LuaHelpers::RunScriptOnStack(L, sError, 2, 0))
|
||||
LOG->Warn("Error running CustomSaveFunction: %s", sError.c_str());
|
||||
RString Error= "Error running CustomSaveFunction: ";
|
||||
LuaHelpers::RunScriptOnStack(L, Error, 2, 0, true);
|
||||
|
||||
LUA->Release(L);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user