Difference between revisions of "Coroutine.create"

From ComputerCraft Wiki
Jump to: navigation, search
(THIS IS NOT JAVA)
(Remove example that doesn’t show anything interesting on its own, improve description, and use type template)
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=coroutine.create
 
|name=coroutine.create
|args=[[Function (type)|function]]
+
|args={{Type|function}} f
 
|api=Coroutine
 
|api=Coroutine
|returns=[[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=func = coroutine.create(function() print("Hello World") end) func()
+
}}
+
 
}}
 
}}
  
 
[[Category:Lua_Core_Functions]]
 
[[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.