| |
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 03 Jan 2013 10:24 AM |
| You use it when you want to run two codes at the same time. Think of updating GUIs... I cannot think of a good example so fast. |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2013 10:26 AM |
| Can also be used to return errors in code. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 03 Jan 2013 10:28 AM |
| What? Coroutines normally don't return errors ;) |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2013 10:33 AM |
| Coroutine continue I am pretty sure it does have a Arguement you can register for that |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2013 10:36 AM |
coroutine.resume(coroutine.create(function() while true do print("coroutine running") wait(2) end end))
while true do print("while loop running") wait(2) end
basically, a coroutine runs on it's own thread (which causes lag). |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2013 11:04 AM |
> Coroutines normally don't return errors ;)
assert(coroutine.resume(coroutine.create(function() printtttttttttt("x") end))) |
|
|
| Report Abuse |
|
|
B0ttle
|
  |
| Joined: 31 Dec 2012 |
| Total Posts: 63 |
|
|
| 03 Jan 2013 11:07 AM |
| It's a loop that doesnt "stop" the script. I mean it's a loop that plays on "background", you see what i mean ? |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
| |
|
|
| 03 Jan 2013 11:17 AM |
I'm not going to explain things right now as I'm on my phone. I'll explain when I get home. None of these dedinitions are adequate so far |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2013 11:18 AM |
| What do you mean "normally"? They always do, as long as there is an error. If there isn't then obviously they won't, because there's no error to return. |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2013 11:24 AM |
| If you yield within the coroutine with wait it won't return any errors. |
|
|
| Report Abuse |
|
|