mirror of
git://projects.qi-hardware.com/nn-usb-fpga.git
synced 2025-04-21 12:27:27 +03:00
Adding file-system
This commit is contained in:
13
sie_fs/root/scripts/lua/test/fibfor.lua
Normal file
13
sie_fs/root/scripts/lua/test/fibfor.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
-- 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
|
||||
Reference in New Issue
Block a user