Remove running scripts before loading session
Clean up scripts instead of just clearing script list
This commit is contained in:
parent
cc10de4033
commit
28d6415190
|
@ -354,6 +354,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
LuaImp.ScriptList.Remove(item);
|
LuaImp.ScriptList.Remove(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RemoveAllLuaFiles()
|
||||||
|
{
|
||||||
|
while (LuaImp.ScriptList.Count > 0)
|
||||||
|
{
|
||||||
|
RemoveLuaFile(LuaImp.ScriptList[LuaImp.ScriptList.Count - 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateDialog()
|
private void UpdateDialog()
|
||||||
{
|
{
|
||||||
LuaListView.RowCount = LuaImp.ScriptList.Count;
|
LuaListView.RowCount = LuaImp.ScriptList.Count;
|
||||||
|
@ -489,6 +497,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public bool LoadLuaSession(string path)
|
public bool LoadLuaSession(string path)
|
||||||
{
|
{
|
||||||
|
RemoveAllLuaFiles();
|
||||||
|
|
||||||
var result = LuaImp.ScriptList.Load(path, Settings.DisableLuaScriptsOnLoad);
|
var result = LuaImp.ScriptList.Load(path, Settings.DisableLuaScriptsOnLoad);
|
||||||
|
|
||||||
foreach (var script in LuaImp.ScriptList)
|
foreach (var script in LuaImp.ScriptList)
|
||||||
|
@ -743,6 +753,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
RemoveAllLuaFiles();
|
||||||
LuaImp.ScriptList.Clear();
|
LuaImp.ScriptList.Clear();
|
||||||
ClearOutputWindow();
|
ClearOutputWindow();
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
|
|
Loading…
Reference in New Issue