Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

the weird thing about using coroutine wrap and checking the status?

local naaa = coroutine.create(function()
	print("hi")
end)
print(coroutine.status(naaa))
wait(1)
coroutine.resume(naaa)
wait(1)
print(coroutine.status(naaa))

yes this is the correct script by using coroutine.create but down here, things get weird

local naaa = coroutine.wrap(function()
	print("hi")
end)
print(coroutine.status(naaa))
wait(1)
naaa()
wait(1)
print(coroutine.status(naaa))

now if you test the code the error comes out "- Workspace.Script:4: bad argument #1 to 'status' (coroutine expected)", i just wanna ask why is it like that?

1 answer

✓ Accepted answer

coroutine.wrap returns a function that is used the same way you would use coroutine.resume(). It does not return a thread reference that you can use with coroutine.status(), unfortunately. That's one of the things you lose when using this wrapper, you get no reference to the thread itself.

This discussion is preserved as it was. New answers, comments, and votes are closed.