Skip to content

Instantly share code, notes, and snippets.

@pawlos
Created January 15, 2017 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pawlos/72bf02cf68e1ca0a619ca9c849a6e09a to your computer and use it in GitHub Desktop.
Save pawlos/72bf02cf68e1ca0a619ca9c849a6e09a to your computer and use it in GitHub Desktop.
Visibility of variable insider inner functions
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