lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Jan 31, 2005, at 02:02, Javier Guerra wrote:

you can compare any kind of value for equality:

Ok... here is what I'm trying to do:

local anArray = { 1, 2, 3 }
local anotherArray = { 1, 2, 3 }
print( tostring( anArray == anotherArray ) )

This returns false. For my purpose, I would like it to return true as equality is defined by two arrays having the same content, not the same address.

Further more, consider a table with custom objects which may define their own notion of equality:

local aKey =
local aValue =
local aTable = { aKey = aValue }


How do I get 'aTable' to invoke 'aKey' equality methods to return the proper 'aValue'?

TIA :)


PA, Onnay Equitursay