Properly handle errors when running a lua script, using Resume/Yield methods added to the LuaThread class (see f904fa0d53)

This commit is contained in:
CasualPokePlayer 2022-12-02 14:44:05 -08:00
parent ae11dcc6af
commit 51f01efdc4
3 changed files with 4 additions and 4 deletions

Binary file not shown.

Binary file not shown.

View File

@ -327,11 +327,11 @@ namespace BizHawk.Client.EmuHawk
{
LuaLibraryBase.SetCurrentThread(lf);
var execResult = _currThread.State.Resume(null, 0);
var execResult = _currThread.Resume();
GuiAPI.ThisIsTheLuaAutounlockHack();
_currThread = null;
var result = execResult == 0
var result = execResult == KeraLua.LuaStatus.OK
? (WaitForFrame: false, Terminated: true) // terminated
: (WaitForFrame: FrameAdvanceRequested, Terminated: false); // yielded
@ -357,12 +357,12 @@ namespace BizHawk.Client.EmuHawk
private void Frameadvance()
{
FrameAdvanceRequested = true;
_currThread.State.Yield(0);
_currThread.Yield();
}
private void EmuYield()
{
_currThread.State.Yield(0);
_currThread.Yield();
}
}
}