diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs index d273911047..af9d3c1e37 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs @@ -1464,17 +1464,15 @@ namespace BizHawk.Client.EmuHawk if (file.Enabled && file.Thread == null) { + LuaImp.RegisteredFunctions.RemoveForFile(file); // First remove any existing registered functions for this file EnableLuaFile(file); + UpdateRegisteredFunctionsDialog(); } else if (!file.Enabled && file.Thread != null) { LuaImp.CallExitEvent(file); - - foreach (var selectedItem in SelectedItems) - { - LuaImp.RegisteredFunctions.RemoveForFile(selectedItem); - UpdateRegisteredFunctionsDialog(); - } + LuaImp.RegisteredFunctions.RemoveForFile(file); + UpdateRegisteredFunctionsDialog(); LuaImp.CallExitEvent(file); file.Stop(); diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaRegisteredFunctionsList.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaRegisteredFunctionsList.cs index c42dc73fae..fee2f09f21 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/LuaRegisteredFunctionsList.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaRegisteredFunctionsList.cs @@ -13,18 +13,9 @@ namespace BizHawk.Client.EmuHawk InitializeComponent(); } - public void NewUpdate(ToolFormUpdateType type) { } - public void UpdateValues() { - if (GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.Any()) - { - PopulateListView(); - } - else - { - Close(); - } + PopulateListView(); } private void LuaRegisteredFunctionsList_Load(object sender, EventArgs e) @@ -46,8 +37,10 @@ namespace BizHawk.Client.EmuHawk { FunctionView.Items.Clear(); - var nlfs = GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.OrderBy(x => x.Event).ThenBy(x => x.Name); - foreach (var nlf in nlfs) + var functions = GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions + .OrderBy(f => f.Event) + .ThenBy(f => f.Name); + foreach (var nlf in functions) { var item = new ListViewItem { Text = nlf.Event }; item.SubItems.Add(nlf.Name);