상속: IDisposable
예제 #1
0
 // TODO 在委托调用中减掉一个LuaFunction, 此lua函数在委托中还会执行一次, 所以必须延迟删除,委托值类型表现之一
 internal void DelayDispose(LuaBaseRef br)
 {
     if (br != null)
     {
         subList.Add(br);
     }
 }
예제 #2
0
        static bool Equals(LuaBaseRef a, LuaBaseRef b)
        {
            if (System.Object.ReferenceEquals(a, b))
            {
                return(true);
            }

            object l = a;
            object r = b;

            if (l == null && r != null)
            {
                return(b.luaState == null);
            }

            if (l != null && r == null)
            {
                return(a.luaState == null);
            }

            if (a.reference != b.reference || a.luaState != b.luaState)
            {
                return(false);
            }

            return(true);
        }
예제 #3
0
        static bool CompareRef(LuaBaseRef a, LuaBaseRef b)
        {
            if (System.Object.ReferenceEquals(a, b))
            {
                return(true);
            }

            object l = a;
            object r = b;

            if (l == null && r != null)
            {
                return(b.reference <= 0);
            }

            if (l != null && r == null)
            {
                return(a.reference <= 0);
            }

            if (a.reference != b.reference)
            {
                return(false);
            }

            return(a.reference > 0);
        }
예제 #4
0
        public override bool Equals(object o)
        {
            if (o == null)
            {
                return(this.reference <= 0);
            }
            LuaBaseRef luaBaseRef = o as LuaBaseRef;

            return(!(luaBaseRef == null) && luaBaseRef.reference == this.reference && this.reference > 0);
        }
예제 #5
0
        public override bool Equals(object o)
        {
            if (o == null)
            {
                return(false);
            }
            LuaBaseRef luaBaseRef = o as LuaBaseRef;

            return(luaBaseRef != null && luaBaseRef.reference == this.reference);
        }
예제 #6
0
 public void Push(LuaBaseRef lbr)
 {
     if (lbr == null)
     {
         LuaPushNil();
     }
     else
     {
         LuaGetRef(lbr.GetReference());
     }
 }
예제 #7
0
 public static void Push(IntPtr L, LuaBaseRef lbr)
 {
     if (lbr == null)
     {
         LuaDLL.lua_pushnil(L);
     }
     else
     {
         LuaDLL.lua_getref(L, lbr.GetReference());
     }
 }
예제 #8
0
        public override bool Equals(object o)
        {
            if (o == null)
            {
                return(reference <= 0);
            }
            LuaBaseRef lr = o as LuaBaseRef;

            if (lr == null || lr.reference != reference)
            {
                return(false);
            }

            return(reference > 0);
        }
예제 #9
0
 private static bool CompareRef(LuaBaseRef a, LuaBaseRef b)
 {
     if (object.ReferenceEquals(a, b))
     {
         return(true);
     }
     if (a == null && b != null)
     {
         return(b == null || b.reference <= 0);
     }
     if (a != null && b == null)
     {
         return(a.reference <= 0);
     }
     return(a.reference == b.reference && a.reference > 0);
 }
예제 #10
0
        public override bool Equals(object o)
        {
            if (o == null)
            {
                return(luaState == null);
            }

            if (System.Object.ReferenceEquals(this, o))
            {
                return(true);
            }

            LuaBaseRef r = o as LuaBaseRef;

            if (r == null || r.reference != reference || r.luaState != luaState)
            {
                return(false);
            }

            return(true);
        }
예제 #11
0
        public LuaBaseRef TryGetLuaRef(int reference)
        {
            WeakReference weak = null;

            if (funcRefMap.TryGetValue(reference, out weak))
            {
                if (weak.IsAlive)
                {
                    LuaBaseRef luaRef = (LuaBaseRef)weak.Target;

                    if (luaRef.IsAlive)
                    {
                        luaRef.AddRef();
                        return(luaRef);
                    }
                }

                funcRefMap.Remove(reference);
            }

            return(null);
        }
예제 #12
0
 public void Push(LuaBaseRef lbr)
 {
     luaState.Push(lbr);
     ++argCount;
 }
예제 #13
0
        static bool CompareRef(LuaBaseRef a, LuaBaseRef b)
        {
            if (System.Object.ReferenceEquals(a, b))
            {
                return true;
            }

            object l = a;
            object r = b;

            if (l == null && r != null)
            {
                return r == null || b.reference <= 0;
            }

            if (l != null && r == null)
            {
                return a.reference <= 0;
            }

            if (a.reference != b.reference)
            {
                return false;
            }

            return a.reference > 0;
        }
예제 #14
0
 public void Push(LuaBaseRef lbr)
 {
     luaState.Push(lbr);
 }
예제 #15
0
 public static bool operator !=(LuaBaseRef a, LuaBaseRef b)
 {
     return(!LuaBaseRef.CompareRef(a, b));
 }
예제 #16
0
 public void Push(LuaBaseRef lbr)
 {
     this.luaState.Push(lbr);
     this.argCount++;
 }
예제 #17
0
 public void Push(LuaBaseRef lbr)
 {
     luaState.Push(lbr);
     ++argCount;
 }