Uses an EnvironmentSandbox to restore the Environment.CurrentDirectory. Will also catch any script exception and redirect them to the Lua console.
With this change, I've tried to replace all the places where Lua is executed so that if an exception occurs, it is catched, sent to the console and a callback is executed if necessary.
This also fixes a small issue where any callback generating an exception would crash BizHawk.
Since events are not executed within the LuaConsole.ResumeScripts method, those did not have Environment.CurrentDirectory available for the executing script.
The fix is simple: when a lua script instantiates a LuaWinForm (through forms.newform), we store the current Environment.CurrentDirectory in the LuaWinForm object.
When a button or checkbox is triggered, it calls WinForm.DoLuaEvent which will set up the Environment.CurrentDirectory for the duration of the callback and then set it back to the initial Environment.CurrentDirectory.