lua-users home
lua-l archive

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



On 17/03/2014 8:27 PM, Luiz Henrique de Figueiredo wrote:
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.


Got it! That's my REXX background burning me where key.value applies to both, which makes sense because REXX only has one type - string.

Thanks