|
| 27 Jul 2015 05:18 AM |
| I'm still curious of what coroutines can make and which games use them. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 05:31 AM |
coroutine divide your script into different sections that can run interdependently when called.
So things like... tweening a gui (which requires a wait, other stuff after that will need to run n stuff) Delaying something while running more code etc. |
|
|
| Report Abuse |
|
|
ByDefault
|
  |
| Joined: 25 Jul 2014 |
| Total Posts: 3197 |
|
|
| 27 Jul 2015 05:37 AM |
Use spawn instead, its easier to use
spawn(function() for i = 1,10 do print(i) end end)
spawn(function() for j = 11,20 do print(j) end end)
will print 1-20 instantly |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 05:38 AM |
daym u just solved the LUA[3] puzzle
lol |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 05:43 AM |
Wiki link to spawn? Can't find it.
And that wasnt my question |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 07:36 AM |
@bydefault "An alternative to this is coroutines. Spawned functions and coroutines aren't used in the same way. Spawn is used to delay the execution of a functions until the thread yields while coroutines are used to run code immediately on a separate thread. You can't send a Spawned function arguments" - roblox wiki |
|
|
| Report Abuse |
|
|