Hi all,
What values would you expect to get printed by the following simple code? Coming from a .NET background I would expect it to print 1,2,3.
local x = 1
timer.performWithDelay( 10, function() print(x) end )
x = 2
timer.performWithDelay( 10, function() print(x) end )
x = 3
timer.performWithDelay( 10, function() print(x) end )
It actually prints 3,3,3. Why does it not push the current value of x onto the stack rather than the end value of x?
Thanks
Adrian