private void DebugScript(string filename) { m_Script = new Script(CoreModules.Basic); m_Script.Options.UseLuaErrorLocations = true; m_Script.Options.DebugPrint = s => { Console_WriteLine("{0}", s); }; var L = new ClassicLuaScriptLoader(); L.ModulePaths = L.UnpackStringPaths("Modules/?;Modules/?.lua"); m_Script.Options.ScriptLoader = L; try { m_Script.LoadFile(filename, null, filename.Replace(':', '|')); } catch (Exception ex) { txtOutput.Text = ""; Console_WriteLine("{0}", ex.Message); return; } m_Script.AttachDebugger(this); Thread m_Debugger = new Thread(DebugMain); m_Debugger.Name = "MoonSharp Execution Thread"; m_Debugger.IsBackground = true; m_Debugger.Start(); }
public void Run() { Script S = new Script(); //S.Globals["print"] = DynValue.NewCallback(Print); S.Options.DebugPrint = Print; S.Options.UseLuaErrorLocations = true; S.Globals.Set("arg", DynValue.NewTable(S)); ClassicLuaScriptLoader L = S.Options.ScriptLoader as ClassicLuaScriptLoader; if (L == null) { L = new ClassicLuaScriptLoader(); S.Options.ScriptLoader = L; } L.ModulePaths = L.UnpackStringPaths("TestMore/Modules/?;TestMore/Modules/?.lua"); S.DoFile(m_File); }