From 1fbcef21462b97b8ac0b673ab69a10fb895442af Mon Sep 17 00:00:00 2001 From: Alessandro Proto Date: Wed, 1 Feb 2023 22:57:58 +0100 Subject: [PATCH] Add base lib for machine functions --- Capy64/Runtime/Libraries/Machine.cs | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Capy64/Runtime/Libraries/Machine.cs diff --git a/Capy64/Runtime/Libraries/Machine.cs b/Capy64/Runtime/Libraries/Machine.cs new file mode 100644 index 0000000..c68ed4a --- /dev/null +++ b/Capy64/Runtime/Libraries/Machine.cs @@ -0,0 +1,43 @@ +using Capy64.API; +using KeraLua; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Capy64.Runtime.Libraries; + +public class Machine : IPlugin +{ + private static IGame _game; + public Machine(IGame game) + { + _game = game; + } + + // todo list + // shutdown, reboot + // set, get title + // get proper version function + // set discord rpc + // + private static LuaRegister[] MachineLib = new LuaRegister[] + { + new(), + }; + + public void LuaInit(Lua L) + { + L.RequireF("machine", OpenLib, false); + } + + private static int OpenLib(IntPtr state) + { + var L = Lua.FromIntPtr(state); + L.NewLib(MachineLib); + return 1; + } + + +}