[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua design : why no lists ?
- From: Mark Hamburg <mhamburg@...>
- Date: Thu, 16 Sep 2004 09:38:56 -0700
Lua actually already has lists reasonably well covered. Or at least
vectors/arrays based on its optimization of storing integer keyed values if
sufficiently dense in a range starting at 1 in a data allocation without
keys.
What Lua doesn't support as efficiently are sets where there are a number of
keys to hash but the values are all "true".
If space were really a concern, this would be an interesting argument for
providing a way for userdata to contain references to Lua values. Or at the
very least, one could expose a hash function which takes a Lua object and
returns a hash code. This could then be used in conjunction with the
existing array support to implement space efficient sets on top of the stock
distribution.
Mark