Sha256: 34735e769e6dd4f7d2880b9ca4004e8a4fbeba6209e41f3c46141f857830b244

Contents?: true

Size: 254 Bytes

Versions: 23

Compression:

Stored size: 254 Bytes

Contents

-- 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

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
dub-1.0.0 test/fixtures/app/vendor/lua/test/fibfor.lua
dub-0.7.0 test/fixtures/app/vendor/lua/test/fibfor.lua
Tamar-0.7.18 src/lua/test/fibfor.lua
Tamar-0.7.17 src/lua/test/fibfor.lua
Tamar-0.7.16 src/lua/test/fibfor.lua
Tamar-0.7.14 src/lua/test/fibfor.lua
Tamar-0.7.13 src/lua/test/fibfor.lua
Tamar-0.7.12 src/lua/test/fibfor.lua
Tamar-0.7.11 src/lua/test/fibfor.lua
Tamar-0.7.10 src/lua/test/fibfor.lua
Tamar-0.7.9 src/lua/test/fibfor.lua
Tamar-0.7.8 src/lua/test/fibfor.lua
Tamar-0.7.7 src/lua/test/fibfor.lua
Tamar-0.7.6 src/lua/test/fibfor.lua
dub-0.6.6 test/fixtures/app/vendor/lua/test/fibfor.lua
dub-0.6.5 test/fixtures/app/vendor/lua/test/fibfor.lua
dub-0.6.4 test/fixtures/app/vendor/lua/test/fibfor.lua
dub-0.6.3 test/fixtures/app/vendor/lua/test/fibfor.lua
dub-0.6.2 test/fixtures/app/vendor/lua/test/fibfor.lua
dub-0.6.1 test/fixtures/app/vendor/lua/test/fibfor.lua