GIEGO04
(GEGO)
#1
Just how can I detect the status of a coroutine?.. 
This code gives me an error
if coroutine.status(DaBroCoroutine) == "suspended" then
print("Hey bro! I'm suspended")
end
ERROR: invalid argument #1 to āstatusā (thread expected, got nil) -

Try searching in Enum. to see if there was status for the coroutines but I didnāt find any
(Neither in the Devforum)
1 Like
The returned status is indeed a string, the error you are getting means the DaBroCoroutine var is nil.
As a reminder you should create coroutines like this:
coro = coroutine.create(function)
--coro is now our thread
print(coroutine.status(coro)) -- prints "suspended"
3 Likes
GIEGO04
(GEGO)
#3
I already did print and thatās why I put suspended because thatās what it printed
My question is how do I detect it in an if statement?
Youāre code is right,
print(coroutine.status(coro) == "suspended") --Prints true if the coroutine is suspended
We can verify this by printing the type of what the status method returns:
print(typeof(coroutine.status(coro))) -- string
1 Like
GIEGO04
(GEGO)
#5
You are right, my code is fine!
My error was due to something else in my code that still didnāt make the value of āDaBroCoroutineā a coroutine.
Srry! 
2 Likes