// Use this for initialization private void Start() { l = new LuaSvr(); l.Init(null, () => { l.Start("valuetype"); }); using (LuaState newState = new LuaState()) { LuaTable table = new LuaTable(newState); Vector2 v2 = new Vector2(1, 2); Vector3 v3 = new Vector3(1, 2, 3); Vector4 v4 = new Vector4(1, 2, 3, 4); Color col = new Color(.1f, .2f, .3f); Foo foo = new Foo(); table["v2"] = v2; table["v3"] = v3; table["v4"] = v4; table["col"] = col; table["foo"] = foo; Assert.IsTrue((Vector2)table["v2"] == v2); Assert.IsTrue((Vector3)table["v3"] == v3); Assert.IsTrue((Vector4)table["v4"] == v4); Assert.IsTrue((Color)table["col"] == col); Assert.IsTrue(table["foo"] == foo); } }
// Use this for initialization private void Start() { l = new LuaSvr(); l.Init(null, () => { l.Start("varobj"); }); }
// Use this for initialization public void Start() { l = new LuaSvr(); l.Init(null, () => { l.Start("delegate"); }); }
public void Start() { svr = new LuaSvr(); svr.Init(null, () => { self = (LuaTable)svr.Start("circle/circle"); update = (LuaFunction)self["update"]; }); }
public void Start() { c = this; l = new LuaSvr(); l.Init(null, () => { l.Start("custom"); }); }
public void Start() { LuaSvr svr = new LuaSvr(); svr.Init(null, () => { LuaFunction func = (LuaFunction)svr.Start("new_coroutine"); func.Call(this); func.Dispose(); }); }
public void Complete() { l.Start("main"); object o = LuaSvr.MainState.GetFunction("foo").Call(1, 2, 3); object[] array = (object[])o; for (int n = 0; n < array.Length; n++) { Debug.Log(array[n]); } string s = (string)LuaSvr.MainState.GetFunction("str").Call(new object[0]); Debug.Log(s); }
// Use this for initialization private void Start() { long startMem = System.GC.GetTotalMemory(true); float start = Time.realtimeSinceStartup; l = new LuaSvr(); l.Init(null, () => { Debug.Log("start cost: " + (Time.realtimeSinceStartup - start)); long endMem = System.GC.GetTotalMemory(true); Debug.Log("startMem: " + startMem + ", endMem: " + endMem + ", " + "cost mem: " + (endMem - startMem)); l.Start("perf"); inited = true; }); #if UNITY_5 Application.logMessageReceived += this.Log; #else Application.RegisterLogCallback(this.log); #endif }