public void LoadScript(string scriptString) { CurrentTempScript?.ResetHooks(); if (string.IsNullOrWhiteSpace(scriptString)) { //No script CurrentTempScript = null; return; } var scr = new HookedScriptContainer(scriptString); CurrentTempScript = scr; runningScript = scr; try { Lua.DoString(scr.ScriptString); } catch (Exception ex) { if (ex is InterpreterException e) { throw new Exception(e.DecoratedMessage); } throw ex; } finally { runningScript = null; } }
public void LoadScript(string scriptString, string scriptName = "User Code") { scriptContainer.ResetHooks(); scriptContainer.SetScript(scriptString); try { Lua.DoString(scriptContainer.ScriptString, null, scriptName); } catch (Exception ex) { if (ex is InterpreterException e) { throw new Exception(e.DecoratedMessage); } throw ex; } AutoHook(); }