Difference between revisions of "Coroutine.close"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2022.3<br/> '''Class:''' coroutine<br/> === Description === Closes and puts the provided coroutine in a dead state. <source lang=...")
 
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Closes and puts the provided coroutine in a dead state.
 
Closes and puts the provided coroutine in a dead state.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(coroutine) = coroutine.close(co)
 
(coroutine) = coroutine.close(co)
</source>
+
</syntaxhighlight>
  
 
  '''Closes and puts the provided coroutine in a dead state. This function returns true unless the coroutine is in an error state, in which case it returns false and the error message. A coroutine that is currently running cannot be closed. A coroutine cannot be resumed after it is closed'''
 
  '''Closes and puts the provided coroutine in a dead state. This function returns true unless the coroutine is in an error state, in which case it returns false and the error message. A coroutine that is currently running cannot be closed. A coroutine cannot be resumed after it is closed'''

Latest revision as of 14:26, 13 July 2023

Available since: Gideros 2022.3
Class: coroutine

Description

Closes and puts the provided coroutine in a dead state.

(coroutine) = coroutine.close(co)
Closes and puts the provided coroutine in a dead state. This function returns true unless the coroutine is in an error state, in which case it returns false and the error message. A coroutine that is currently running cannot be closed. A coroutine cannot be resumed after it is closed

Parameters

co: (thread)

Return values

Returns (boolean) true unless the coroutine being closed is in an error state
Returns (string) the error message, if any