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) |