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);
|
Global.Config.RecentLua.Add(path);
|
||||||
|
|
||||||
if (!Global.Config.DisableLuaScriptsOnLoad)
|
if (!Global.Config.DisableLuaScriptsOnLoad)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
l.Thread = LuaImp.SpawnCoroutine(path);
|
l.Thread = LuaImp.SpawnCoroutine(path);
|
||||||
l.Enabled = true;
|
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;
|
else l.Enabled = false;
|
||||||
l.Paused = false;
|
l.Paused = false;
|
||||||
changes = true;
|
changes = true;
|
||||||
|
@ -189,8 +201,8 @@ namespace BizHawk.MultiClient
|
||||||
if (path == luaList[i].Path && luaList[i].Enabled == false && !Global.Config.DisableLuaScriptsOnLoad)
|
if (path == luaList[i].Path && luaList[i].Enabled == false && !Global.Config.DisableLuaScriptsOnLoad)
|
||||||
{
|
{
|
||||||
luaList[i].Toggle();
|
luaList[i].Toggle();
|
||||||
LuaListView.Refresh();
|
|
||||||
RunLuaScripts();
|
RunLuaScripts();
|
||||||
|
LuaListView.Refresh();
|
||||||
changes = true;
|
changes = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +257,19 @@ namespace BizHawk.MultiClient
|
||||||
item.Toggle();
|
item.Toggle();
|
||||||
}
|
}
|
||||||
if (item.Enabled && item.Thread == null)
|
if (item.Enabled && item.Thread == null)
|
||||||
|
try
|
||||||
|
{
|
||||||
item.Thread = LuaImp.SpawnCoroutine(item.Path);
|
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)
|
else if (!item.Enabled && item.Thread != null)
|
||||||
item.Stop();
|
item.Stop();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue