// Update is called once per frame void Update() { // c# call lua function with value type but no gc (using delegate) f1(1); // primitive type Vector3 v3 = new Vector3(1, 2, 3); // vector3 f2(v3); MyStruct mystruct = new MyStruct(5, 6); // custom complex value type f3(mystruct); f4(MyEnum.E1); //enum decimal d = -32132143143100109.00010001010M; decimal dr = f5(d); System.Diagnostics.Debug.Assert(d == dr); // using LuaFunction.Func<T1, T2, TResult> System.Diagnostics.Debug.Assert(add.Func<int, int, int>(34, 56) == (34 + 56)); // LuaFunction.Func<T1, T2, TResult> // lua access c# value type array no gc farr(a1); //primitive value type array farr(a2); //vector3 array farr(a3); //custom struct array farr(a4); //enum arry farr(a5); //decimal arry // lua call c# no gc with value type flua(); //c# call lua using interface ie.exchange(a2); //no gc LuaTable use luaenv.Global.Set("g_int", 456); int i; luaenv.Global.Get("g_int", out i); System.Diagnostics.Debug.Assert(i == 456); luaenv.Global.Set(123.0001, mystruct); MyStruct mystruct2; luaenv.Global.Get(123.0001, out mystruct2); System.Diagnostics.Debug.Assert(mystruct2.b == mystruct.b); decimal dr2 = 0.0000001M; luaenv.Global.Set((byte)12, d); luaenv.Global.Get((byte)12, out dr2); System.Diagnostics.Debug.Assert(d == dr2); int gdata = luaenv.Global.Get<int>("GDATA"); luaenv.Global.SetInPath("GDATA", gdata + 1); System.Diagnostics.Debug.Assert(luaenv.Global.Get<int>("GDATA") == gdata + 1); int abc = luaenv.Global.GetInPath<int>("A.B.C"); luaenv.Global.SetInPath("A.B.C", abc + 1); System.Diagnostics.Debug.Assert(luaenv.Global.GetInPath<int>("A.B.C") == abc + 1); luaenv.Tick(); }
// Update is called once per frame void Update() { // c# call lua function with value type but no gc (using delegate) f1(1); // primitive type Vector3 v3 = new Vector3(1, 2, 3); // vector3 f2(v3); MyStruct mystruct = new MyStruct(5, 6); // custom complex value type f3(mystruct); f4(MyEnum.E1); //enum decimal d = -32132143143100109.00010001010M; decimal dr = f5(d); System.Diagnostics.Debug.Assert(d == dr); // using LuaFunction.Func<T1, T2, TResult> System.Diagnostics.Debug.Assert(add.Func <int, int, int>(34, 56) == (34 + 56)); // LuaFunction.Func<T1, T2, TResult> // lua access c# value type array no gc farr(a1); //primitive value type array farr(a2); //vector3 array farr(a3); //custom struct array farr(a4); //enum arry farr(a5); //decimal arry // lua call c# no gc with value type flua(); //c# call lua using interface ie.exchange(a2); //no gc LuaTable use luaenv.Global.Set("g_int", 456); int i; luaenv.Global.Get("g_int", out i); System.Diagnostics.Debug.Assert(i == 456); luaenv.Global.Set(123.0001, mystruct); MyStruct mystruct2; luaenv.Global.Get(123.0001, out mystruct2); System.Diagnostics.Debug.Assert(mystruct2.b == mystruct.b); decimal dr2 = 0.0000001M; luaenv.Global.Set((byte)12, d); luaenv.Global.Get((byte)12, out dr2); System.Diagnostics.Debug.Assert(d == dr2); int gdata = luaenv.Global.Get <int>("GDATA"); luaenv.Global.SetInPath("GDATA", gdata + 1); System.Diagnostics.Debug.Assert(luaenv.Global.Get <int>("GDATA") == gdata + 1); int abc = luaenv.Global.GetInPath <int>("A.B.C"); luaenv.Global.SetInPath("A.B.C", abc + 1); System.Diagnostics.Debug.Assert(luaenv.Global.GetInPath <int>("A.B.C") == abc + 1); luaenv.Tick(); }
public MyStruct StructParamMethod(MyStruct p) { return p; }
public MyStruct StructParamMethod(MyStruct p) { return(p); }