Difference between revisions of "Coroutine.create"

From ComputerCraft Wiki
Jump to: navigation, search
m (Function -> Function (type))
(wub)
Line 4: Line 4:
 
|args=[[Function (type)|function]] function
 
|args=[[Function (type)|function]] function
 
|api=Coroutine
 
|api=Coroutine
|returns=[[coroutine]] new coroutine
+
|returns=[[coroutine]]
 
|addon=ComputerCraft
 
|addon=ComputerCraft
 
|desc=Creates a new coroutine
 
|desc=Creates a new coroutine
Line 10: Line 10:
 
{{Example
 
{{Example
 
|desc=creates a coroutine.
 
|desc=creates a coroutine.
|code=coroutine.create(function() print("Hello World") end)
+
|code=func = coroutine.create(function() print("Hello World") end) func()
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:Lua_Core_Functions]]
 
[[Category:Lua_Core_Functions]]

Revision as of 12:11, 4 December 2012


Grid Redstone.png  Function coroutine.create
Creates a new coroutine
Syntax coroutine.create(function function)
Returns coroutine
Part of ComputerCraft
API Coroutine

Examples

Grid paper.png  Example
creates a coroutine.
Code
func = coroutine.create(function() print("Hello World") end) func()