예제 #1
0
 public LuaFunction(int reference, LuaState interpreter)
 {            
     _Reference = reference;
     this.function = null;
     _Interpreter = interpreter;
     L = _Interpreter.L;
     translator = _Interpreter.translator;            
 }
예제 #2
0
 public LuaFunction(LuaCSFunction function, LuaState interpreter)
 {
     _Reference = 0;
     this.function = function;
     _Interpreter = interpreter;
     L = _Interpreter.L;
     translator = _Interpreter.translator;            
 }
예제 #3
0
        public LuaManager()
        {
            mLuastate = new LuaState();
            foreach (var script in LuaConfig.DefaultScripts)
                this.DoResourceFile(script);
            this.AddGlobalFunction("AddSearchPath", luaState.GetFunction("AddSearchPath"));
            this.AddSearchPath(LuaConfig.ScriptAssetsPath);

        }
예제 #4
0
        public virtual void Dispose(bool disposeManagedResources)
        {
            if (!_Disposed)
            {
                if (_Reference != 0 && _Interpreter != null)
                {
                    if (disposeManagedResources)
                    {
                        _Interpreter.dispose(_Reference);
                        _Reference = 0;
                    }
                    else if (_Interpreter.L != IntPtr.Zero)
                    {                                                
                        LuaScriptMgr.refGCList.Enqueue(new LuaRef(_Interpreter.L, _Reference));
                        _Reference = 0;
                    }
                }

                _Interpreter = null;
                _Disposed = true;
            }
        }