[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Query about user data equality.
- From: "Paul Winwood"<Paul_Winwood@...>
- Date: Tue, 15 May 2001 17:25:09 GMT
I am using Lua 4.0
>From the previous reply to a query from myself by lhf I have implemented
what I called 'deferred evaluation' for my user data objects.
This 'deferred evaluation' technique uses all the tag
methods to implement my user data as a full Lua object. This all works
excellently with one exception. The exception is that there is no tag method
call for equality testing (when compared with the 'lt' tag method) when
comparing a table or user data agains another type.
Would it be a good idea to add an 'eq' (or similar) tag method to allow such
equality testing ? I can of course ask my users to work around this by
say adding a constant to the user data item (hence invoking the 'add'
tagmethod) before calling the equality operator but this seems somewhat
of a hack. I think doing this would make the mapping between external
boolean types and 'nil' much easier.
I have noticed that in the function luaO_equalObj() which is called by the
OP_JMPNE and OP_JMPEQ opcodes. Would this be a suitable place to
insert such a tag method call?
Paul.