lua-users home
lua-l archive

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

On 01/10/2011 20:43, Stefan Reich wrote:
Putting lists and maps in one structure is a little weird. It tends to
favor the maps I'd say. Arrays, technically, are usually things that
take a linear space in memory. Processors understand arrays easily.
However, the Lua structure for arrays is more like a map with
integers. It's a really different thing, and sometimes it shows in its

Pure linear arrays in Lua are implemented with just a linear space in memory.

I find the relation between nil and lists also confusing.

As often advised in the list, just don't put nils in an array if you don't want holes. You can use any marker value if you want to indicate the absence of value. The logic is the same (I never use nils as false value like 'if something then' when something isn't explicitly a boolean, anyway) so in general you keep a consistent data structure like you wish.

Philippe Lhoste
--  (near) Paris -- France
--  --  --  --  --  --  --  --  --  --  --  --  --  --