Loading A Script With Errors Via Load Lua File Now Disables And Shows Error In Output Box. Toggling On A Script With Errors Disables Itself Right Away.
This commit is contained in:
parent
c5334cc639
commit
e2e3ee3301
|
@ -174,10 +174,22 @@ namespace BizHawk.MultiClient
|
|||
Global.Config.RecentLua.Add(path);
|
||||
|
||||
if (!Global.Config.DisableLuaScriptsOnLoad)
|
||||
{
|
||||
try
|
||||
{
|
||||
l.Thread = LuaImp.SpawnCoroutine(path);
|
||||
l.Enabled = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e.ToString().Substring(0, 32) == "LuaInterface.LuaScriptException:")
|
||||
{
|
||||
l.Enabled = false;
|
||||
AddText(e.Message);
|
||||
}
|
||||
else MessageBox.Show(e.ToString());
|
||||
}
|
||||
}
|
||||
else l.Enabled = false;
|
||||
l.Paused = false;
|
||||
changes = true;
|
||||
|
@ -189,8 +201,8 @@ namespace BizHawk.MultiClient
|
|||
if (path == luaList[i].Path && luaList[i].Enabled == false && !Global.Config.DisableLuaScriptsOnLoad)
|
||||
{
|
||||
luaList[i].Toggle();
|
||||
LuaListView.Refresh();
|
||||
RunLuaScripts();
|
||||
LuaListView.Refresh();
|
||||
changes = true;
|
||||
break;
|
||||
}
|
||||
|
@ -245,7 +257,19 @@ namespace BizHawk.MultiClient
|
|||
item.Toggle();
|
||||
}
|
||||
if (item.Enabled && item.Thread == null)
|
||||
try
|
||||
{
|
||||
item.Thread = LuaImp.SpawnCoroutine(item.Path);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e.ToString().Substring(0, 32) == "LuaInterface.LuaScriptException:")
|
||||
{
|
||||
item.Enabled = false;
|
||||
AddText(e.Message);
|
||||
}
|
||||
else MessageBox.Show(e.ToString());
|
||||
}
|
||||
else if (!item.Enabled && item.Thread != null)
|
||||
item.Stop();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue