lua-users home
lua-l archive

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


On Fri, Mar 17, 2006 at 11:25:19PM -0600, Gregg Reynolds wrote:
> 
> >From the ISO standard for Z (a model of clarity and simplicity, IMO):
> 

Actually, tables in Lua were partially inspired by VDM maps :)


> Regardless of the fate of those suggestions, the Language Manual for 5.1
> seems inconsistent on this subject.  In section 2.2 it states
> unequivocally that tables "can contain values of all types (except
> nil)", and "the value of a table field can be of any type (except nil)".
>    But in 2.5 ("The Length Operator"), it states "If the array has
> 'holes' (that is, nil values between other non-nil values)...".  One way
> or another that should be fixed.

Tables cannot contain nils, but arrays can. An array (or a sequence)
is an abstraction that we build on top of tables. The fact that its
underling representation does not store the nil does not mean that,
abstractly, the nil is not there.

-- Roberto