Difference between revisions of "Coroutine.status"

From ComputerCraft Wiki
Jump to: navigation, search
m (Moved to CAT:LuaCoreFunctions)
(Remove example that doesn’t show anything interesting on its own, improve description, and use type template)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Function
 
{{Function
 
|name=coroutine.status
 
|name=coroutine.status
 +
|args={{Type|coroutine}} coro
 
|api=Coroutine
 
|api=Coroutine
|returns=[[string]] status
+
|returns={{Type|string}} status
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Returns the status of the coroutine; returns "running", if the coroutine is running; "suspended" if the coroutine was yielded or not running; "normal" if the coroutine is active but not running (that is, it has resumed another coroutine); and "dead" if it finished its function.
+
|desc=Returns the status of <var>coro</var>. This is one of “running”, if the coroutine is running; “suspended”, if the coroutine has not yet been started or it called [[coroutine.yield]] and has not yet been resumed; “normal”, if the coroutine called [[coroutine.resume]] and that call has not yet returned (equivalently, if <var>coro</var> is an ancestor of the currently executing coroutine); or “dead”, if its function returned.
|examples=
+
|examples=Please see [[Coroutine (API)]] for a worked example of using all the coroutine functions.
{{Example
+
|desc=Writes the status of the running coroutine.
+
|code=print(coroutine.status(coroutine.running()))
+
|output=running
+
}}
+
 
}}
 
}}
  
 
[[Category:Lua_Core_Functions]]
 
[[Category:Lua_Core_Functions]]

Latest revision as of 18:24, 22 April 2013

Grid Redstone.png  Function coroutine.status
Returns the status of coro. This is one of “running”, if the coroutine is running; “suspended”, if the coroutine has not yet been started or it called coroutine.yield and has not yet been resumed; “normal”, if the coroutine called coroutine.resume and that call has not yet returned (equivalently, if coro is an ancestor of the currently executing coroutine); or “dead”, if its function returned.
Syntax coroutine.status(coroutine coro)
Returns string status
Part of ComputerCraft
API Coroutine

Examples

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