Advertisement
Vapio

coroutine.lua

Aug 25th, 2023 (edited)
561
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. local coroutine_first = nil
  2. local coroutine_second = nil
  3.  
  4. local function caller_first()
  5.     print("First coroutine")
  6.     print("Starting second coroutine")
  7.     result_coroutine = coroutine_second      
  8. end
  9.  
  10. local function caller_second()
  11.     print("Second coroutine")
  12.     print("Starting first coroutine")
  13.     result_coroutine = coroutine_first
  14.        
  15. end
  16.  
  17. function main()
  18.     coroutine_first = coroutine.wrap(caller_first())
  19.     print("Test between wraps")
  20.     coroutine_second = coroutine.wrap(caller_second())
  21.     result_coroutine = coroutine_first  
  22.     print("End main" + result_coroutine)    
  23. end
  24.  
  25. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement