How bad is it in Lua 5.1 to never let a coroutine properly end? In other words, if a coroutine yields but I never resume it, does it leave a lot of state lying around until program completion?
cor=coroutine.wrap(somefunc)
while true do
done=cor()
if done then -- coroutine exited with "return true"
break
else -- coroutine yielded with "coroutine.yield(false)"
if some_condition then break end
end
end
function somefunc()
-- do something
coroutine.yield(false)
-- do some more
return true
end
Depending on some_condition in the pseudocode above, the coroutine might never be resumed, and thus might never properly "end".
Could I do this to dozens of coroutines without having to worry? Is it safe to leave coroutines in this state? Is it expensive?