lua-users home
lua-l archive

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


> for i=0,2 do
>     local i_store = i
>     local a = function() end;
>     print(a);
> end

You need to use i inside the function to create different closures:

for i=0,2 do
    local a = function() local _=i end
    print(a)
end

But why do you need different functions that do the same thing? 
(or should I say same nothing? :-)