Created
January 15, 2017 11:23
-
-
Save pawlos/72bf02cf68e1ca0a619ca9c849a6e09a to your computer and use it in GitHub Desktop.
Visibility of variable insider inner functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = {} | |
local x = 20 | |
for i=1,10 do | |
local y = 0 | |
a[i] = function () y=y+1; return x+y end | |
print(a[i]()) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment