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?
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.