lua-users home
lua-l archive

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


> Lua 5.2 will not: it will resuse the closure.

when it can.  with different upvalues you get different functions (of course):

> for i=1,3 do
>        local f = function(a, b) print("run " .. i ..": a statement") return a + b end
>        local a = f(10, 20) + 30    + i
>        print(f,a)
> end

Bye,
Wim