Difference between revisions of "Coroutine (API)"

From ComputerCraft Wiki
Jump to: navigation, search
(Created Table containing commands for coroutine API.)
m (Added Link to Coroutine.)
Line 3: Line 3:
 
'''From ComputerCraft 1.3''' this API suffers from the problem of potentially spawning Java threads that live forever therefore, use of coroutines should be minimized. This is '''fixed in ComputerCraft 1.32+''', though.
 
'''From ComputerCraft 1.3''' this API suffers from the problem of potentially spawning Java threads that live forever therefore, use of coroutines should be minimized. This is '''fixed in ComputerCraft 1.32+''', though.
 
|}
 
|}
 +
 +
''This is for the Coroutine API. For the Coroutine Object, visit [[Coroutine]].''
  
 
Coroutine is a default Lua 5.1 API defined [http://www.lua.org/manual/5.1/manual.html#5.2 here].  
 
Coroutine is a default Lua 5.1 API defined [http://www.lua.org/manual/5.1/manual.html#5.2 here].  

Revision as of 17:27, 13 November 2012

Bug

From ComputerCraft 1.3 this API suffers from the problem of potentially spawning Java threads that live forever therefore, use of coroutines should be minimized. This is fixed in ComputerCraft 1.32+, though.

This is for the Coroutine API. For the Coroutine Object, visit Coroutine.

Coroutine is a default Lua 5.1 API defined here. Please list any non-working functions here.

Methods

Method name Description
coroutine.create(function) Creates and Returns a new coroutine.
coroutine.resume(coroutine, [var1], [var2], ...) Starts or Resumes an already-made coroutine.
coroutine.running() Returns the coroutine running (nil of it's the main coroutine).
coroutine.status(coroutine) Returns the status of the given coroutine.
coroutine.wrap(function) Creates and Returns a new coroutine in the form of a function.
coroutine.yield([var1], [var2], ...) Pauses the coroutine. Variables passed will be extra variables next time the coroutine starts.


List of non-working functions

List any non-working functions here.