lua-users home
lua-l archive

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

Hi Steve,

I'm not sure if its just nomenclature or if we're mixing metaphors, but isn't it possible to define an array such that it doesn't have any holes in it per definition?

In my view, an array is defined by a range of continuous indices from 1 to n. Any index that is not associated with a value (yet) should have a default value of nil (or some other set default). This implicitly excludes any notion of holes in an array.

I believe that is one of the true distinctions between the map and array views of lua-tables. With maps you cannot distinguish between a hole from an unassigned entry in a standard lua-table, but with an array we can as long as we know the dimension of that array, without any ambiguity.

Could you please define your array semantics in more detail?

Thanks, Frank.

On Jan 11, 2011, at 1:45 AM, steve donovan wrote:

> On Tue, Jan 11, 2011 at 11:08 AM, Axel Kittenberger <> wrote:
>> Or in other words, tables keep to be the basic Lua building block, but
>> Lists is a default construct that builds on tables and makes
>> insert/remove/# operations easy.
> For instance, [1]. Again, you do pay a penalty, but it should be
> impossible to put holes in your array with this class.  It would be
> interesting to find the fastest possible implementation that preserves
> the paranoid properties!
> steve d.
> [1]