Difference between revisions of "Coroutine.wrap"

From GiderosMobile
Line 12: Line 12:
 
=== <translate>Return values</translate> ===
 
=== <translate>Return values</translate> ===
 
'''<translate>Returns</translate>''' (function) <translate>function that resumes coroutine every time it is called, behaving similar to coroutine.resume</translate><br/>
 
'''<translate>Returns</translate>''' (function) <translate>function that resumes coroutine every time it is called, behaving similar to coroutine.resume</translate><br/>
 +
 +
{{Coroutine}}

Revision as of 22:01, 11 February 2020


Available since: Gideros 2011.6
Class: coroutine

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.

(function) = coroutine.wrap(f)

Parameters

f: (function) lua function

Return values

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