Jump to content




[Question] Coroutines ?


  • You cannot reply to this topic
4 replies to this topic

#1 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 06 May 2013 - 04:17 AM

Hi there! I've seen many topics and stuff using coroutines.

What are they? Can someone please explain in detail..

Thanks.
//Mackan90096

#2 1lann

  • Members
  • 516 posts
  • LocationSeattle

Posted 06 May 2013 - 04:27 AM

http://lua-users.org...outinesTutorial
Generally you would want to stick with parallel.waitForAny or parallel.waitForAll. There are plenty of tutorials on this in the tutorials section. I would link you to some but I'm on my phone at the moment and it's quite a hassle.

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 06 May 2013 - 04:40 AM

As 1lann stated most times you will just want to stick with the parallel api as it is managed coroutines, you don't need to know how they work, you just request them to work.

Also just a slight change to the opening line of that link 1lann posted, coroutines actually cannot allow us to do multiple things at the same time, it may seem to the user that it is at the same time, but actually only one coroutine is running at any given time, and it must yield in order for the next to run... in CC that is where os.pullEvent's come in, they call coroutine.yield.

#4 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 06 May 2013 - 06:28 AM

Cranium asked about coroutines. Go check out that post, they are thoroughly explained there.

#5 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 06 May 2013 - 01:27 PM

coroutines are a bit advanced, if you want basic multitasking use the parallel API:
http://www.computerc...l-parallel-api/





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users