So I am making a script, and I was testing if something I needed in my script works. So here is what I did to test.
function f()
local c = coroutine.wrap(function()
while wait(1) do
print('yay')
end
end)
c()
wait(5)
return
end
f()
It prints "yay" more then 10 times. What would I do to yield a coroutine outside of the coroutine, and why does using return on the function the coroutine is on not stop the coroutine?

2 comments
Why not remove the while loop??
It's an example for something else I will do. The wait(5) and return should still run, since while loop is in coroutine.