Lua console - When turning on lua scripts, first clear registered functions for that scripts (they would still exist if the script exited on its own), Don't close the registered functions dialog when a script is toggled and no registered functions are left
This commit is contained in:
parent
1b264ad068
commit
978277bd06
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue