Difference between revisions of "Thread:setFunction"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' 2018.10<br/>
'''<translate>Available since</translate>:''' 2018.10<br/>
+
'''Class:''' [[Thread]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Thread|Thread]]<br/>
 
  
=== <translate>Description</translate> ===
+
=== Description ===
<translate>Sets Lua function that thread will execute. Will return false if the function cannot be set because the thread is
+
Sets a Lua function that thread will execute.
currently running or suspended.
+
<syntaxhighlight lang="lua">
</translate><br/>
+
ok = thread:setFunction(func)
<source lang="lua">local ok = thread:setFunction(func)</source>
+
</syntaxhighlight>
  
=== <translate>Parameters</translate> ===
+
Will return false if the function cannot be set because the thread is currently running or suspended.
'''func: ''' ''(function)'' <translate>Lua code to run in thread.</translate><br/>
+
 
=== <translate>Return values</translate> ===
+
=== Parameters ===
'''ok: ''' ''(boolean)'' <translate>success or failure</translate><br/>
+
'''func: ''' ''(function)'' Lua code to run in thread<br/>
 +
 
 +
=== Return values ===
 +
'''ok: ''' ''(boolean)'' success<br/>
  
 
{{Thread}}
 
{{Thread}}

Latest revision as of 15:33, 13 July 2023

Available since: 2018.10
Class: Thread

Description

Sets a Lua function that thread will execute.

ok = thread:setFunction(func)

Will return false if the function cannot be set because the thread is currently running or suspended.

Parameters

func: (function) Lua code to run in thread

Return values

ok: (boolean) success