while true do
wait(1)
print(coroutine.status(NewRoundThread))
if coroutine.status(NewRoundThread) ~= "suspended" then
coroutine.resume(NewRoundThread)
end
end
Only returns it's state, when it returns prints busy, it still doesn't resume
while true do
wait(1)
print(coroutine.status(NewRoundThread))
if coroutine.status(NewRoundThread) ~= "suspended" then
coroutine.resume(NewRoundThread)
end
end
Only returns it's state, when it returns prints busy, it still doesn't resume
This discussion is preserved as it was. New answers, comments, and votes are closed.
6 comments
Did you mean to put "if coroutine.status(NewRoundThread) == "suspended" then"
i was meaning to put if it is not suspended, it say's suspended when the coroutine is active. when its not active it says dead.
You can't resume a thread that's already going.
So a thread has to manually be stopped? I thought it ran the lines, then killed the thread...
coroutine.create()creates a brand new thread from a function and returns a coroutine object. You can then transfer control to this thread usingcoroutine.resume(co), passing the coroutine object as first argument. The thread will die if it errors or upon reaching the end of the function's body, and can be suspended upon a call tocoroutine.yield(). It is important to note, however, that Luaokay, thank you for actually explaining, i finally understand... Thanks alot.