public LuaMain() { LuaVM = new LuaVirtualMachine(); // we don't have to register them on level load because this is a global singleton, not a level one RegisterLuaFunctions(this); // though we do have to restart lua when we change levels LevelManager.OnLevelLoad += (e) => { Restart(); }; LuaVM.Lua.DoString("print(\"All working over here!\")"); Launch.Log("[Loading] Lua engine successfully started!"); }
/// <summary> /// Quits, disposes, and creates a new Lua VM, then runs the re-registration event. /// </summary> public void Restart() { Quit(); LuaVM.Lua.Dispose(); LuaVM = new LuaVirtualMachine(); RunRegisterEvent(); }
public void InitVirtualMachine() { LUA = new LuaVirtualMachine(1, null, new LuaFunctionRepository(), Proxy); }