lua-users home
lua-l archive

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


On Wednesday, March 16, 2016 at 10:21AM, Dirk Laurie wrote:
> Lua's table type is so general and versatile that a bit of discipline in
> its usage does not come amiss. For most of my tables, I follow the
> following rules.
> 
> 1. The table is a proper sequence (§3.4.7 of the Lua 5.3 manual).
> 2. The [0] entry, if present, is an index to an arbitrary selection of
>    keys, usually a string with pieces gmatching "%a%w*" but sometimes
>    just a list of values.
> 3. I seldom use 'pairs'.

I think I see the use of (1) and (3), but what's the point of (2)?

Thanks.
-- 
We have not been faced with the need to satisfy someone else's
requirements, and for this freedom we are grateful.
    Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System