Ejemplo n.º 1
0
        public void GCCSObject(int index)
        {
            int    objectReference = LuaLib.wutlua_rawuserdata(L, index);
            object o     = _objects[objectReference];
            int    refId = _objectUserdataRefIds[o];

            UnityEngine.Debug.Log(string.Format("GC [{0}({1})]: {2}", objectReference, refId, o.ToString()));

            LuaLib.luaL_unref(L, LuaIndices.LUA_REGISTRYINDEX, refId);
            _objectUserdataRefIds.Remove(o);
            _objects.Remove(objectReference);
        }
Ejemplo n.º 2
0
        public virtual void Dispose(bool disposeManagedResources)
        {
            if (_isDisposed)
            {
                return;
            }

            if (disposeManagedResources)
            {
                if (_RefId != 0 && _LuaState.L != IntPtr.Zero)
                {
                    LuaLib.luaL_unref(_LuaState.L, LuaIndices.LUA_REGISTRYINDEX, _RefId);
                }
            }

            _LuaState = null;

            _isDisposed = true;
        }