This IS actually possible to implement in Lua, and it's not TOO
horribly inefficient (O(n log m) overhead per construction, no
additional overhead for reading and indexing):
It gets more complicated and slow if you want the tuple table to be self-cleaning though (add in gc/weak-table overhead). I would imagine that a built-in tuple type would be much more efficient since it would just index on the sum of the hashes of the elements and only check the elements on collisions, or am I missing something?