lua-users home
lua-l archive

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


> Languages like Ruby, Python, etc. allow you to define hash functions that
> apply to your objects.  You define a hash function and a comparison
> function, and this lets user-defined types be keys in hash tables based on
> their values.

In Lua, any value can be used as a table key. But for objects, this means
that their address is used rather than the contents. Is that the issue?
If so, can't it be addressed by calling new/put/get functions that compute
new keys for objects based on whatever is needed by the app? And of course
use a table as the underlying container.