Difference between revisions of "Coroutine.resume"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
'''Class:''' [[coroutine]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/coroutine|coroutine]]<br/>
 
=== <translate>Description</translate> ===
 
<translate>Starts or continues the execution of coroutine co. The first time you resume a coroutine, it starts running its body. The values val1, ··· are passed as the arguments to the body function. If the coroutine has yielded, resume restarts it; the values val1, ··· are passed as the results from the yield.
 
  
 +
=== Description ===
 +
Starts or continues the execution of coroutine co.
 +
<syntaxhighlight lang="lua">
 +
(bool), (multiple) = coroutine.resume(co,...)
 +
</syntaxhighlight>
  
  If the coroutine runs without any errors, resume returns true plus any values passed to yield (if the coroutine yields) or any values returned by the body function (if the coroutine terminates). If there is any error, resume returns false plus the error message.</translate>
+
  '''The first time you resume a coroutine, it starts running its body. The values ... are passed as the arguments to the body function. If the coroutine has yielded, resume restarts it; the values ... are passed as the results from the yield. If the coroutine runs without any errors, resume returns true plus any values passed to yield (if the coroutine yields) or any values returned by the body function (if the coroutine terminates). If there is any error, resume returns false plus the error message'''
<source lang="lua">
+
 
(bool), (multiple) = coroutine.resume(co,val1,...)
+
=== Parameters ===
</source>
+
'''co''': (thread) coroutine to start or resume <br/>
=== <translate>Parameters</translate> ===
+
'''...''': (any) other optional values to pass as results '''optional'''<br/>
'''co''': (coroutine) <translate>coroutine to start or resume</translate> <br/>
+
 
'''val1''': (any) <translate>value to pass as the result</translate> '''optional'''<br/>
+
=== Return values ===
'''...''': (any) <translate>other optional values to pass as results</translate> '''optional'''<br/>
+
'''Returns''' (bool) true if coroutine ran without errors, false otherwise<br/>
=== <translate>Return values</translate> ===
+
'''Returns''' (multiple) values provided to ''coroutine.yield'' function call<br/>
'''<translate>Returns</translate>''' (bool) <translate>true if coroutine ran without errors, false otherwise</translate><br/>
 
'''<translate>Returns</translate>''' (multiple) <translate>values provided to coroutine.yield function call</translate><br/>
 
  
 
{{Coroutine}}
 
{{Coroutine}}

Latest revision as of 15:26, 13 July 2023

Available since: Gideros 2011.6
Class: coroutine

Description

Starts or continues the execution of coroutine co.

(bool), (multiple) = coroutine.resume(co,...)
The first time you resume a coroutine, it starts running its body. The values ... are passed as the arguments to the body function. If the coroutine has yielded, resume restarts it; the values ... are passed as the results from the yield. If the coroutine runs without any errors, resume returns true plus any values passed to yield (if the coroutine yields) or any values returned by the body function (if the coroutine terminates). If there is any error, resume returns false plus the error message

Parameters

co: (thread) coroutine to start or resume
...: (any) other optional values to pass as results optional

Return values

Returns (bool) true if coroutine ran without errors, false otherwise
Returns (multiple) values provided to coroutine.yield function call