Coroutine.yield

From ComputerCraft Wiki
Revision as of 18:24, 22 April 2013 by Hawk777 (Talk | contribs) (Remove example that doesn’t show anything interesting on its own, improve description, and fix wrong argument list)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Grid Redstone.png  Function coroutine.yield
Pauses the currently executing coroutine and passes control to its parent. The parent is the coroutine that started this coroutine by calling coroutine.resume on it. The parent regains control by coroutine.resume returning; the child becomes suspended (and can therefore be resumed by coroutine.resume). If parameters var1, var2, etc. are passed, those values appear in the return value from coroutine.resume in the parent. If the call to coroutine.resume that next resumes the child coroutine has parameters, those parameters are returned from the call to this function.
Syntax coroutine.yield([var1], [var2], …)
Returns [var3], [var4], …
Part of ComputerCraft
API Coroutine

Examples

Please see Coroutine (API) for a worked example of using all the coroutine functions.