Difference between revisions of "Coroutine.yield"
From ComputerCraft Wiki
m (Moved to CAT:LuaCoreFunctions) |
(Remove example that doesn’t show anything interesting on its own, improve description, and fix wrong argument list) |
||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
|name=coroutine.yield | |name=coroutine.yield | ||
− | |args=[ | + | |args=[var1], [var2], … |
|api=Coroutine | |api=Coroutine | ||
+ | |returns=[var3], [var4], … | ||
|addon=ComputerCraft | |addon=ComputerCraft | ||
− | |desc=Pauses | + | |desc=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 <var>var1</var>, <var>var2</var>, 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. |
− | + | |examples=Please see [[Coroutine (API)]] for a worked example of using all the coroutine functions. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}} | }} | ||
[[Category:Lua_Core_Functions]] | [[Category:Lua_Core_Functions]] |
Latest revision as of 18:24, 22 April 2013
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.