Hi,
We know that Lua’s coroutine has four statuses – suspended, running, dead, normal.
The “coroutine.status()” is used to check a coroutine’s current status.
The below example can tell me in which status the corountine exist.
function foo()
print("foo", 1)
coroutine.yield()
print("foo", 2)
end
co = coroutine.create(foo) -- create a coroutine with foo as the entry
=type(co)
function foo()
print("foo", 1)
coroutine.yield()
print("foo", 2)
end
co = coroutine.create(foo) -- create a coroutine with foo as the entry
print(type(co))
print(coroutine.status(co)) -- suspended
coroutine.resume(co)
print(coroutine.status(co)) -- suspended
coroutine.resume(co)
print(coroutine.status(co)) -- dead
who can give me a example that show “running” and “normal” status ?
That’s, which conditions we can receive coroutine’s running and normal status?
Thanks.