adeMacBook-Pro:lua_soft apple$ curl -R -O http://www.lua.org/ftp/lua-5.3.0.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
00000000 --:--:-- --:--:-- --:--:-- 000000000 --:--:-- 0:00:04 --:--:-- 05 271k 51550800223800:02:040:00:060:01:583533100 271k 100 271k 003130800:00:080:00:08 --:--:-- 83547
View Code
curl -R -O http://www.lua.org/ftp/lua-5.3.0.tar.gz
tar zxf lua-5.3.0.tar.gz
cd lua-5.3.0
make linux test
-- Fibonacci sequence with coroutines
function fibo()
a, b = 0, 1whiletruedo
coroutine.yield(a)
a, b = b, a + b
end
end
co = coroutine.create(fibo)
n = arg[1] or 20for i = 0, n do
print(i,coroutine.resume(co))
end