1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| [CSharpCallLua] public delegate int AddDelegate(int a, int b);
int a_b, a_c, b_c; [CSharpCallLua] public delegate int TestDelegate(int a, int b, int c, out int a_b, out int a_c, out int b_c);
Action<string> action1 = luaEnv.Global.Get<Action<string>>("eat"); action1("apple");
AddDelegate add = luaEnv.Global.Get<AddDelegate>("add"); int sum = add(100, 200); Debug.Log(sum);
TestDelegate test = luaEnv.Global.Get<TestDelegate>("test"); int _sum = test(100, 200, 500, out a_b, out a_c, out b_c); Debug.Log(string.Format("a+b+c={0} a+b={1} a+c={2} b+c={3}", _sum, a_b, a_c, b_c));
action1 = null; add = null; test = null;
luaEnv.Dispose();
|