示例#1
0
 public override bool Equals(object o)
 {
     if (o is LuaBase)
     {
         LuaBase luaBase = (LuaBase)o;
         return(this._Interpreter.compareRef(luaBase._Reference, this._Reference));
     }
     return(false);
 }
示例#2
0
 public override bool Equals(object o)
 {
     if (o is LuaBase)
     {
         LuaBase l = (LuaBase)o;
         return(Interpreter.compareRef(l.Reference, Reference));
     }
     else
     {
         return(false);
     }
 }
示例#3
0
        /// <summary>Full Lua equality which can be controlled with metatables.</summary>
        public bool LuaEquals(LuaBase o)
        {
            if (o == null || o.Owner != Owner)
            {
                return(false);
            }
            var L = Owner._L;

            luanet.checkstack(L, 2, "LuaBase.LuaEquals");
            rawpush(L);
            o.rawpush(L);
            try { return(lua.equal(L, -1, -2)); }
            finally { lua.pop(L, 2); }
        }
示例#4
0
        /// <summary>Raw equality. (For table field lookups, Lua uses raw comparisons internally.)</summary>
        public bool Equals(LuaBase o)
        {
            if (o == null || o.Owner != Owner)
            {
                return(false);
            }
            var L = Owner._L;

            luanet.checkstack(L, 2, "LuaBase.Equals");
            rawpush(L);
            o.rawpush(L);
            bool ret = lua.rawequal(L, -1, -2);

            lua.pop(L, 2);
            return(ret);
        }
示例#5
0
        /// <summary>Full Lua equality which can be controlled with metatables.</summary>
        public bool LuaEquals(LuaBase o)
        {
            if (o == null || o.Owner != Owner)
            {
                return(false);
            }
            var L = Owner._L;

            luaclr.checkstack(L, 2, "LuaBase.LuaEquals");
            rawpush(L);
            o.rawpush(L);
            int oldTop = -3;

            try { return(lua.equal(L, -1, -2)); }
            catch (LuaInternalException) { oldTop = -1; throw; }
            finally { lua.settop(L, oldTop); }
        }
示例#6
0
 public static int GetReference(LuaBase luaObject)
 {
     Object reference = luaObject.GetType().InvokeMember(
         "_Reference",
         BindingFlags.Public |
         BindingFlags.NonPublic |
         BindingFlags.Instance |
         BindingFlags.GetField,
         null,
         luaObject,
         null
     );
        return (int)reference;
 }