/// <summary> /// Run the specified script. /// </summary> /// <param name="scriptFile">Script file name</param> public void RunScript(string scriptFile) { if (File.Exists(scriptFile)) { try { using (NLua.Lua lua = new NLua.Lua()) { lua.LoadCLRPackage(); _luaAPI.RegisterFunctions(lua); lua.DoFile(scriptFile); LuaFunction fnc = lua.GetFunction("on_Run"); if (fnc != null) { fnc.Call(); } } } catch (LuaScriptException e) { MessageBox.Show(e.Message, Resources.ScriptException, MessageBoxButtons.OK); } } }