Too many variables in an assignment may cause a C stack overflow. (7)
[lua.git] / test / fibfor.lua
blob8bbba39cd7635f3cc7b7b0d2284b85a6864675e3
1 -- example of for with generator functions
3 function generatefib (n)
4 return coroutine.wrap(function ()
5 local a,b = 1, 1
6 while a <= n do
7 coroutine.yield(a)
8 a, b = b, a+b
9 end
10 end)
11 end
13 for i in generatefib(1000) do print(i) end