Getting closer. Now catches a .NET exception in user code.
This commit is contained in:
parent
5c2587ecfb
commit
33ca14a344
|
@ -13,7 +13,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
public class LuaImplementation
|
public class LuaImplementation
|
||||||
{
|
{
|
||||||
Lua lua = new Lua();
|
Lua lua = new Lua();
|
||||||
LuaConsole Caller;
|
LuaConsole Caller;
|
||||||
public String LuaLibraryList = "";
|
public String LuaLibraryList = "";
|
||||||
public EventWaitHandle LuaWait;
|
public EventWaitHandle LuaWait;
|
||||||
|
@ -23,9 +23,13 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public LuaImplementation(LuaConsole passed)
|
public LuaImplementation(LuaConsole passed)
|
||||||
{
|
{
|
||||||
EventWaitHandle LuaWait = new AutoResetEvent(false);
|
LuaWait = new AutoResetEvent(false);
|
||||||
LuaLibraryList = "";
|
LuaLibraryList = "";
|
||||||
Caller = passed.get();
|
Caller = passed.get();
|
||||||
|
LuaRegister(lua);
|
||||||
|
}
|
||||||
|
public void LuaRegister(Lua lua)
|
||||||
|
{
|
||||||
lua.RegisterFunction("print", this, this.GetType().GetMethod("print"));
|
lua.RegisterFunction("print", this, this.GetType().GetMethod("print"));
|
||||||
|
|
||||||
//Register libraries
|
//Register libraries
|
||||||
|
@ -82,7 +86,14 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
string F = File.ToString();
|
string F = File.ToString();
|
||||||
isRunning = true;
|
isRunning = true;
|
||||||
lua.DoFile(F);
|
try
|
||||||
|
{
|
||||||
|
lua.DoFile(F);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Exception caught. " + e.ToString());
|
||||||
|
}
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
LuaWait.Set();
|
LuaWait.Set();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue