lua-users home
lua-l archive

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

On 02/20/2017 12:00 AM, Dirk Laurie wrote:
> Would you occasionally code
>     tbl = { [1]="abc", [2]="def", k1=nil, k2=nil}
> rather than
>     tbl = {"abc","def"}
> deliberately?

> tbl = {<...>, k1=nil, k2=nil}
Yes by hands, as documentation in class definition which indicates
that these fields are used but filled somewhere later.

> tbl = {[1]="abc", [2]="def", <...>}
No by hands but yes in programmatic serializer of lua tables to
string which is lua code producing given table. Usually it
serializes tables with many (thousands) values, so documenting
exact position makes sense.