lua-users home
lua-l archive

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



On 16-Sep-04, at 11:38 AM, Mark Hamburg wrote:

What Lua doesn't support as efficiently are sets where there are a number of
keys to hash but the values are all "true".

In many cases where there are a large number of such sets, all these sets share a single key domain (universe). (Option sets, for example, or state sets). In this case, you can create a Universe table which maps keys to integers and vice versa (assuming the keys cannot be integers, otherwise you need two tables), and implement the set itself as a long bit-vector; the only Lua object which needs to be referenced is the universe itself.