Difference between revisions of "Coroutine.resume"
From ComputerCraft Wiki
m (Moved to CAT:LuaCoreFunctions) |
(Remove example that doesn’t show anything interesting on its own, improve description, and use type template) |
||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
|name=coroutine.resume | |name=coroutine.resume | ||
− | |args= | + | |args={{Type|coroutine}} coro, [var1], [var2], … |
|api=Coroutine | |api=Coroutine | ||
+ | |returns={{Type|boolean}} <code>true</code> and the values returned from <var>coro</var>’s body (if it returned) or passed to [[coroutine.yield]] (if it yielded) on success, or <code>false</code> and a message if <var>coro</var> cannot be resumed (e.g. because it is not suspended) or if its body throws an error | ||
|addon=ComputerCraft | |addon=ComputerCraft | ||
− | |desc= | + | |desc=Starts or resumes an existing coroutine. The second and subsequent parameters are passed as parameters to <var>coro</var>’s body if this is the first resumption of <var>coro</var>, or appear as return values from [[coroutine.yield]] otherwise. The coroutine calling this function becomes the parent of <var>coro</var>. |
− | + | |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:25, 22 April 2013
Function coroutine.resume | |
Starts or resumes an existing coroutine. The second and subsequent parameters are passed as parameters to coro’s body if this is the first resumption of coro, or appear as return values from coroutine.yield otherwise. The coroutine calling this function becomes the parent of coro. | |
Syntax | coroutine.resume(coroutine coro, [var1], [var2], …) |
Returns | boolean true and the values returned from coro’s body (if it returned) or passed to coroutine.yield (if it yielded) on success, or false and a message if coro cannot be resumed (e.g. because it is not suspended) or if its body throws an error |
Part of | ComputerCraft |
API | Coroutine |
Examples
Please see Coroutine (API) for a worked example of using all the coroutine functions.