[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Indexed tables (Was: [Proposal] .name global indexing)
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 16 Mar 2016 10:21:47 +0200
2016-03-13 22:05 GMT+02:00 Alloyed <alloyed@tfwno.gf>:
> I don't like the idea that the order of a table literal might matter,
> especially for cases where tables are generated by code.
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'.