lua-users home
lua-l archive

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

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

Yes; this A) is a form of documentation that shows the
expected/allowed/future members of your table; and B) will preallocate
a table that will be sure to fit all the members.

I often do it in my libraries. e.g.