Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. a = {} -- déclaration d'une table 'a'
  2. local x = 20 -- déclaration d'une variable locale 'x'
  3. for i = 1, 10 do
  4. local y = 0 -- déclaration d'une nouvelle variable locale
  5. -- et interne à la boucle for ... end
  6. a[i] = function() y = y + 1; return x + y end
  7. print("i = "..i.." (x + y) = "..x + y)
  8. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement