diff --git a/BizHawk.MultiClient/LuaImplementation.cs b/BizHawk.MultiClient/LuaImplementation.cs index 9b6087f3ca..1df35b29be 100644 --- a/BizHawk.MultiClient/LuaImplementation.cs +++ b/BizHawk.MultiClient/LuaImplementation.cs @@ -28,6 +28,12 @@ namespace BizHawk.MultiClient Caller = passed.get(); LuaRegister(lua); } + + public void Close() + { + lua.Close(); + } + public void LuaRegister(Lua lua) { lua.RegisterFunction("print", this, this.GetType().GetMethod("print")); diff --git a/BizHawk.MultiClient/tools/LuaConsole.cs b/BizHawk.MultiClient/tools/LuaConsole.cs index 69a6025f04..a43f7bd60e 100644 --- a/BizHawk.MultiClient/tools/LuaConsole.cs +++ b/BizHawk.MultiClient/tools/LuaConsole.cs @@ -104,6 +104,7 @@ namespace BizHawk.MultiClient private void SaveConfigSettings() { + LuaImp.Close(); Global.Config.LuaConsoleWndx = this.Location.X; Global.Config.LuaConsoleWndy = this.Location.Y; Global.Config.LuaConsoleWidth = this.Right - this.Left; @@ -559,12 +560,18 @@ namespace BizHawk.MultiClient public void WriteToOutputWindow(string message) { + if (!OutputBox.IsHandleCreated || OutputBox.IsDisposed) + return; + OutputBox.Text += message; OutputBox.Refresh(); } public void ClearOutputWindow() { + if (!OutputBox.IsHandleCreated || OutputBox.IsDisposed) + return; + OutputBox.Text = ""; OutputBox.Refresh(); }