Advertisement
Eliaseeg

Coroutine example!

Apr 4th, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.27 KB | None | 0 0
  1. co = coroutine.create(
  2. function()
  3.     for i=1,3 do
  4.         print(i)
  5.         print('status:'..coroutine.status(co))
  6.         coroutine.yield()
  7.     end
  8. end
  9. )
  10.  
  11. function b()
  12.     coroutine.resume(co)
  13.     return 'status:'..coroutine.status(co)
  14. end
  15.  
  16. print(b())
  17. print(b())
  18. print(b())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement