[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Equality tag method.
- From: "Paul Winwood"<Paul_Winwood@...>
- Date: Tue, 24 Jul 2001 15:28:17 GMT
In LUA, there exists a tag method 'lt' used when an ordering operation is
applied to tables or user
data operands. However there is no equivalent tag method for when the equality
operation is
applied to tables or user data. If my understanding is correct, then equality
for user data is
determined purely by the address of the data.
Consider the case that I have a numeric type implemented as user data. I would
like to compare
that type agains a numeric value. At the moment I can only do this by having a
function defined
that returns the numeric value of the numeric type. If I could have an 'eq'
equality tag method I
can implement that method for my numeric user data type and return the result of
the equality
test and I would no longer need the function to extract the numeric value from
the user data.
This tag method could equally usefully also be applied to tables.
Paul.