Last active
November 24, 2015 16:56
-
-
Save usysrc/a3e2b6a414e4eb86f812 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-- recursion in lua | |
-- global | |
rec = function(i) | |
rec(i+1) | |
end | |
-- forward definition | |
local func | |
func = function(i) | |
func(i+1) | |
end | |
-- call function | |
local call = function(f) | |
f(f) | |
end | |
local i = 0 | |
call(function(this) | |
print("1") | |
i = i + 1 | |
if i < 3 then | |
this(this) | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment