Yes, it will be cleaned up. It won’t be immediate (the GC runs periodically), but it will happen.
local function ABC()
while true do
local abc = coroutine.create(ABC)
for i = 1,3 do
-- 'abc' out of scope here
In that scenario, once abc goes out of scope or is set to nil, the GC will be able to clean up the coroutine. Similarly, if you were to overwrite abc to a different coroutine, the old one would still be cleaned up since all of its references were lost.