lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 14 Dec 2013 02:16 PM |
are coroutines automatically while loops like can i call it like this
function Source() wait() print("Hello World!") end local newCoroutine = coroutine.create(Source)
and it'll automatically make it while true do or do i have to do this
function Source() while true do wait() print("Hello World!") end end local newCoroutine = coroutine.create(Source) |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 02:18 PM |
| coroutines are threads which allow the script to do more than one thing at a time they are not automatic while loops. |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
| |
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 14 Dec 2013 02:31 PM |
function Source() while true do wait() print("Hello World!") end end
local newCoroutine = coroutine.create(Source)
if I do
coroutine.resume(newCoroutine)
it'd start the while loop
and then
coroutine.yield(newCoroutine)
would stop it? |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
| |
|