Difference between revisions of "Coroutine.running"

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)
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
 
|name=coroutine.running
 
|name=coroutine.running
 
|api=Coroutine
 
|api=Coroutine
|returns=[[coroutine]] running coroutine
+
|returns={{Type|coroutine}} the executing coroutine
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Returns the running coroutine, or nil if running the main coroutine.
+
|desc=Returns the running coroutine. If only the implicit top-level coroutine is running, [[nil]] is returned; however, ordinary applications will never see this because the CraftOS BIOS runs the shell, and therefore any application code, inside a coroutine.
|examples=
+
|examples=Please see [[Coroutine (API)]] for a worked example of using all the coroutine functions.
{{Example
+
|desc=Stops the currently running coroutine
+
|code=coroutine.yield(coroutine.running())
+
}}
+
 
}}
 
}}
 +
 +
[[Category:Lua_Core_Functions]]

Latest revision as of 18:25, 22 April 2013

Grid Redstone.png  Function coroutine.running
Returns the running coroutine. If only the implicit top-level coroutine is running, nil is returned; however, ordinary applications will never see this because the CraftOS BIOS runs the shell, and therefore any application code, inside a coroutine.
Syntax coroutine.running()
Returns coroutine the executing coroutine
Part of ComputerCraft
API Coroutine

Examples

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