lua-users home
lua-l archive

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


when I use a script such as:

function myfunc()
local a, b = 1,2

and repeat the line "local a, b = 1,2" over 100 times in the function, I get the following error:
input:102: function at line 1 has more than 200 local variables

I'm wondering whether this is intended behaviour because actually, I'm only using
two variables named 'a' and 'b'. They are all placed in the same scope so I don't
quite understand why Lua creates 200 variables from these two. Because the initializations
occur always in the same scope, Lua wouldn't have to store 200 variables on the
stack but it could simply work with two. Any explanations for this behaviour?