Пример #1
0
    private void OnDestroy()
    {
        act  = null;
        act1 = null;
        act3 = null;
        act4 = null;

        if (env != null)
        {
            env.Dispose();
        }
    }
Пример #2
0
    // Start is called before the first frame update
    private void Start()
    {
        env = new LuaEnv();
        env.DoString("require 'CallLua'");

        //1
        act = env.Global.Get <Action>("ProcMyFunc1");
        act.Invoke();

        //2
        act1 = env.Global.Get <delAdding>("ProcMyFunc2");
        act1(3, 4);

        //3
        act3 = env.Global.Get <Action <int, int, int> >("ProcMyFunc4");
        act3(3, 4, 5);

        //4 带返回值的
        act4 = env.Global.Get <Func <int, int, int> >("ProcMyFunc3");
        int rel = act4(10, 20);

        Debug.Log("4 带返回值的-" + rel);
    }