pub fn yield(values: Repeatable<any>) -> Repeatable<any>Expand description
Suspends the execution of the calling coroutine. Any arguments are
returned as extra results by the resume that woke the coroutine
up; symmetrically, yield returns the extra values passed to the
next resume.
§Examples
local co = coroutine.create(function(a)
local b = coroutine.yield(a * 2) -- b comes from the next resume
return a + b
end)
print(coroutine.resume(co, 10)) --> true 20
print(coroutine.resume(co, 5)) --> true 15