lua-users home
lua-l archive

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

> When writing: automatically assign a single-entry table to each undefined
> variable, with the given index the sole entry.  For example, if t is an
> undefined variable, then t[a] = v would be syntactic sugar for t = {[a] =
> v}.  Similarly, if t[a][b] is already declared as a table but t[a][b][c] is
> nil, then t[a][b][c][d][e] = v would mean t[a][b][c] = {[d] = {[e] = v}}.

Note that Lua does not index variables, it indexes values. For instance,
in the expression 'f(x).k = 1', if 'f(x)' is nil, there is no variable
to get the new table.

-- Roberto