LuaInterface.LuaObjectPool.Destroy C# (CSharp) Method

Destroy() public method

public Destroy ( int pos ) : object
pos int
return object
        public object Destroy(int pos)
        {
            if (pos > 0 && pos < count)
            {
                object o = list[pos].obj;
                list[pos].obj = null;
                return o;
            }

            return null;
        }

Usage Example

示例#1
0
        // C#中删除一个对象 对Lua的引用没有影响
        // 常见问题:C#中已经删除,但是lua中的引用还在,导致问题很难查
        public void Destroy(int udata)
        {
            object o = objects.Destroy(udata);

            if (o != null)
            {
                if (!TypeChecker.IsValueType(o.GetType()))
                {
                    RemoveObject(o, udata);
                }
                Debugger.Log("destroy object {0}, id {1}", o, udata);
            }
        }
All Usage Examples Of LuaInterface.LuaObjectPool::Destroy