Lua console - use the LoadLuaSession() method consistently instead of copy pasta

This commit is contained in:
adelikat 2020-05-31 10:53:58 -05:00
parent 324a50a0bb
commit 98827aee47
1 changed files with 3 additions and 15 deletions

View File

@ -666,16 +666,10 @@ namespace BizHawk.Client.EmuHawk
if (load)
{
if (!LuaImp.ScriptList.LoadLuaSession(path, Settings.DisableLuaScriptsOnLoad))
if (!LoadLuaSession(path))
{
Config.RecentLuaSession.HandleLoadError(path);
}
else
{
RunLuaScripts();
UpdateDialog();
LuaImp.ScriptList.Changes = false;
}
}
AddFileWatches();
@ -772,10 +766,7 @@ namespace BizHawk.Client.EmuHawk
var result = ofd.ShowHawkDialog();
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(ofd.FileName))
{
LuaImp.ScriptList.LoadLuaSession(ofd.FileName, Settings.DisableLuaScriptsOnLoad);
RunLuaScripts();
UpdateDialog();
LuaImp.ScriptList.Changes = false;
LoadLuaSession(ofd.FileName);
}
}
@ -1303,10 +1294,7 @@ namespace BizHawk.Client.EmuHawk
}
else if (Path.GetExtension(path)?.ToLower() == ".luases")
{
LuaImp.ScriptList.LoadLuaSession(path, Settings.DisableLuaScriptsOnLoad);
RunLuaScripts();
UpdateDialog();
LuaImp.ScriptList.Changes = false;
LoadLuaSession(path);
return;
}
}