Difference between revisions of "Coroutine.wrap"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === Creates a new coroutine, with body f. f must be a Lua function. Returns a function that resumes the co...")
 
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 +
'''Class:''' [[coroutine]]<br/>
 +
 
=== Description ===
 
=== Description ===
Creates a new coroutine, with body f. f must be a Lua function. Returns a function that resumes the coroutine each time it is called. Any arguments passed to the function behave as the extra arguments to resume. Returns the same values returned by resume, except the first boolean. In case of error, propagates the error.
+
Creates a new coroutine and returns a function that, when called, resumes the coroutine.
<source lang="lua">
+
<syntaxhighlight lang="lua">
(function), = coroutine.wrap(f,)
+
(function) = coroutine.wrap(f)
</source>
+
</syntaxhighlight>
'''f:''' (function) lua function ''''''<br/>
+
 
 +
'''Creates a new coroutine, with body f. f must be a Lua function. Returns a function that resumes the coroutine each time it is called. Any arguments passed to the function behave as the extra arguments to resume. Returns the same values returned by resume, except the first boolean. In case of error, propagates the error'''
 +
 
 +
=== Parameters ===
 +
'''f''': (function) lua function<br/>
 +
 
 +
=== Return values ===
 
'''Returns''' (function) function that resumes coroutine every time it is called, behaving similar to coroutine.resume<br/>
 
'''Returns''' (function) function that resumes coroutine every time it is called, behaving similar to coroutine.resume<br/>
 +
 +
{{Coroutine}}

Latest revision as of 14:26, 13 July 2023

Available since: Gideros 2011.6
Class: coroutine

Description

Creates a new coroutine and returns a function that, when called, resumes the coroutine.

(function) = coroutine.wrap(f)
Creates a new coroutine, with body f. f must be a Lua function. Returns a function that resumes the coroutine each time it is called. Any arguments passed to the function behave as the extra arguments to resume. Returns the same values returned by resume, except the first boolean. In case of error, propagates the error

Parameters

f: (function) lua function

Return values

Returns (function) function that resumes coroutine every time it is called, behaving similar to coroutine.resume