[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: 0x102a70?
- From: PA <petite.abeille@...>
- Date: Mon, 31 Jan 2005 04:51:28 +0100
On Jan 31, 2005, at 03:10, Rici Lake wrote:
You can do that by giving both tables the same __eq metamethod,
although I'm not a great fan of that solution. See below.
By the way, where are all those 'magic' operators defined?
Note the difference between the __eq approach for equality (in which
equality is defined by the compared values) and the above approach (in
which equality is defined by the containing table).
Ok. I will dig deeper in those exotic metatable operators :)
In the meantime, here is the monster I have concocted... sigh...
-- instance method to compare the given object with this list
this.equals = function( anObject )
if this == anObject then
if anObject ~= nil then
local count = this.size()
if count == anObject.size() then
for index = 1, count do
local aValue = this.get( index )
local anotherValue =
anObject.get( index )
if this.isKindOf( aValue ) ==
true and aValue.equals( anotherValue ) == false then
if aValue ~= anotherValue then
PA, Onnay Equitursay