lua-users home
lua-l archive

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


> local a = {}
> for i = 1, arg[1] do a.i = i * i end

This is not doing what you think it is: it is setting just one entry in the
table, the one with key "i". Check the contents of the table after the loop.

In general, a.x is sugar for a["x"]. Even if x happens to be the name of
a variable, in a.x it is used as a string, not a variable.