nrscsy
|
  |
| Joined: 09 Nov 2012 |
| Total Posts: 465 |
|
|
| 21 Nov 2012 04:14 PM |
I'm not entirely sure, but I suspect an error here. The error is at the Beginner's guide to coroutines:
" running means that the coroutine is currently working and using its code. dead means that the coroutine has stopped running and is done for now. suspended means coroutine.yield() ran and it's waiting to start up again. normal means it hasn't been told to start running yet. "
Here is the code given:
" function core() print("hola") end new_thread=coroutine.create(core) print(coroutine.status(new_thread)) coroutine.resume(new_thread) print(coroutine.status(new_thread)) "
And this is the result of the code:
" suspended hola dead "
Shouldn't the result code be:
normal hola dead? Since the created coroutine never used yield inside it. |
|
|
| Report Abuse |
|
|
|
| 21 Nov 2012 04:17 PM |
| I've never seen normal as a result. I think the suspended result is correct. I'll go check PiL. |
|
|
| Report Abuse |
|
|
|
| 21 Nov 2012 04:19 PM |
Yeah, this is what Programming in Lua has to say. "A coroutine can be in one of three different states: suspended, running, and dead. When we create a coroutine, it starts in the suspended state. That means that a coroutine does not run its body automatically when we create it." |
|
|
| Report Abuse |
|
|
nrscsy
|
  |
| Joined: 09 Nov 2012 |
| Total Posts: 465 |
|
|
| 21 Nov 2012 04:20 PM |
| Then the normal status shouldn't be there. I got to admit it had me confused until I realized the code didn't match up with the result. |
|
|
| Report Abuse |
|
|
|
| 21 Nov 2012 04:23 PM |
Meh, I got stripped of my wiki writer status. Probably because I haven't been on there in a year, hahaha.
Sorry, we'll have to wait for someone else to come along and make that change. |
|
|
| Report Abuse |
|
|
nrscsy
|
  |
| Joined: 09 Nov 2012 |
| Total Posts: 465 |
|
|
| 21 Nov 2012 04:24 PM |
| Alright then. The most active writer I've seen is Arceus, so hopefully he will pass by soon. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 21 Nov 2012 05:12 PM |
| I'll go ahead and change that then. |
|
|
| Report Abuse |
|
|