lua-users home
lua-l archive

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


> 
> If the userdata points to the same object why not use the same userdata
> value?
> 

Yes, that can be done with some gymnastics (see my workaround suggestion,
and Matt's).  

The bottom line (for me) is that Lua has a logical hole because it defines
__eq without a corresponding __hash.  

Let's set userdata aside for a minute: You can overload the equality
behavior of two tables by overloading __eq, but the table's behavior as keys
doesn't follow the same rule.

Why not make __hash a part of the language?  Would it add a major
performance penalty?