Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
254 B

  1. -- example of for with generator functions
  2. function generatefib (n)
  3. return coroutine.wrap(function ()
  4. local a,b = 1, 1
  5. while a <= n do
  6. coroutine.yield(a)
  7. a, b = b, a+b
  8. end
  9. end)
  10. end
  11. for i in generatefib(1000) do print(i) end