Files
itgmania212121/stepmania/src/lua-5.1/test/fibfor.lua
T
Glenn Maynard 4564b0d5a2 Update to Lua 5.1.
This is normally statically linked in releases.  Lua also needs
some patching in Linux x86 to fix performance issues related
to alignment, will need patching if we want fine-grained threading,
and generally has an odd "build it yourself" design, so let's
just add embed this one.  (note: disable PCH for these files
in VC, and don't add lua.c, luac.c, or print.c to the project)
2006-09-25 07:35:34 +00:00

14 lines
254 B
Lua

-- example of for with generator functions
function generatefib (n)
return coroutine.wrap(function ()
local a,b = 1, 1
while a <= n do
coroutine.yield(a)
a, b = b, a+b
end
end)
end
for i in generatefib(1000) do print(i) end