public void Close() { Started = false; SharpLua.LuaObject close = L.GetFunction("close"); L.CallFunction(close); L.Close(); L = null; }
public void FixedUpdate() { if (!Started) { return; } SharpLua.LuaObject fixedupdate = L.GetFunction("fixedupdate"); L.CallFunction(fixedupdate, Time.fixedDeltaTime); }
public void Update() { if (!Started) { return; } SharpLua.LuaObject update = L.GetFunction("update"); L.CallFunction(update, Time.deltaTime); }
public LuaVM(string main, string init) { L = new SharpLua(main, init); SharpLua.LuaObject set_print = L.GetFunction("set_print"); SharpLua.SharpFunction sharpPrint = LuaPrint; L.CallFunction(set_print, sharpPrint); SharpLua.LuaObject loader = L.GetFunction("unity_res_load"); SharpLua.SharpFunction luaLoader = LuaLoader; L.CallFunction(loader, luaLoader); }
public void Start(params object[] args) { Started = true; SharpLua.LuaObject init = L.GetFunction("init"); L.CallFunction(init); SharpLua.LuaObject message = L.GetFunction("set_call_sharp"); SharpLua.SharpFunction sharpMsg = LuaCaller; L.CallFunction(message, sharpMsg); SharpLua.LuaObject start = L.GetFunction("start"); L.CallFunction(start, args); }
static public void Main() { SharpLua l = new SharpLua("main.lua"); SharpLua.LuaObject load = l.GetFunction("load"); SharpLua.LuaObject f = (SharpLua.LuaObject)l.CallFunction(load, "return ...")[0]; object[] result = l.CallFunction(f, "Hello World", l); Console.WriteLine((string)result[0]); Console.WriteLine(result[1].GetType()); SharpLua.LuaObject gc = l.GetFunction("collectgarbage"); l.CallFunction(gc, "collect"); l.CollectGarbage(); SharpLua.LuaObject init = l.GetFunction("init"); SharpLua.SharpFunction func = FuncCallByLua; l.CallFunction(init, func); SharpLua.LuaObject callback = l.GetFunction("callback"); l.CallFunction(callback, 1, null, "string"); }
public void GC() { SharpLua.LuaObject gc = L.GetFunction("collectgarbage"); L.CallFunction(gc, "collect"); L.CollectGarbage(); }
public void CallLua(params object[] args) { SharpLua.LuaObject input = L.GetFunction("call_by_sharp"); L.CallFunction(input, args); }