of     1   

cofunction
#182926396Wednesday, February 03, 2016 7:45 AM GMT

local co = coroutine.create(function() print(coroutine.status(co)) end) coroutine.resume(co) I have two questions about this: (just trying to get an understanding on this) 1.) The coroutine.status give an error (the one inside the function)when I call in the brackets the thread/functions name but when I do "coroutine.status without putting the thread/function name it works? 2.) "print(coroutine.resume(co))" When I don't put the 'coroutine.resume' inside the brackets in a 'print()' it won't resume it, why is this? Note: I've fixed the code easily, I'm just curious on why it was breaking. #Code print("Song Link: http://www.roblox.com/Deorro-vs-Swedish-House-Mafia-Save-The-5-Hours-item?id=340827217")
cntkillme
#182926491Wednesday, February 03, 2016 7:51 AM GMT

When you do 'coroutine.status(co)', the local variable 'co' doesn't exist at the time so it generates a GETGLOBAL meaning it'll look for a global variable named 'co'. What you need to do is something like: local co; -- forward declare co = coroutine.create(function() print(coroutine.status(co)) end) coroutine.resume(co)
cofunction
#182926518Wednesday, February 03, 2016 7:52 AM GMT

ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh. Thanks :D. #Code print("Song Link: http://www.roblox.com/Deorro-vs-Swedish-House-Mafia-Save-The-5-Hours-item?id=340827217")
cntkillme
#182926573Wednesday, February 03, 2016 7:56 AM GMT

Slightly irrelevant but can be good to know is that this happen because the right side is evaluated before the left side. So if you try to do: local x, y = 5, x + 1; Expecting y to be 6, it'll actually try to look up the global variable "x".

    of     1