Difference between revisions of "Coroutine.create"

From ComputerCraft Wiki
Jump to: navigation, search
(Created Page)
 
(Remove example that doesn’t show anything interesting on its own, improve description, and use type template)
 
(5 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=coroutine.create
 
|name=coroutine.create
|args=[[function]] function
+
|args={{Type|function}} f
 
|api=Coroutine
 
|api=Coroutine
|returns=[[coroutine]] new coroutine
+
|returns={{Type|coroutine}} the new coroutine
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Creates a new coroutine
+
|desc=Creates a new coroutine. When the new coroutine is resumed for the first time, it will begin by invoking <var>f</var>. When <var>f</var> returns, the coroutine will become dead.
|examples=
+
|examples=Please see [[Coroutine (API)]] for a worked example of using all the coroutine functions.
{{Example
+
|desc=creates a coroutine.
+
|code=coroutine.create(function() print("Hello World") end)
+
}}
+
 
}}
 
}}
 +
 +
[[Category:Lua_Core_Functions]]

Latest revision as of 18:24, 22 April 2013


Grid Redstone.png  Function coroutine.create
Creates a new coroutine. When the new coroutine is resumed for the first time, it will begin by invoking f. When f returns, the coroutine will become dead.
Syntax coroutine.create(function f)
Returns coroutine the new coroutine
Part of ComputerCraft
API Coroutine

Examples

Please see Coroutine (API) for a worked example of using all the coroutine functions.