Difference between revisions of "Thread:setFunction"

From GiderosMobile
(removed language stuff)
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(2 intermediate revisions by 2 users not shown)
Line 4: Line 4:
  
 
=== Description ===
 
=== Description ===
Sets a 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">
<source lang="lua">
+
ok = thread:setFunction(func)
local ok = thread:setFunction(func)
+
</syntaxhighlight>
</source>
+
 
 +
Will return false if the function cannot be set because the thread is currently running or suspended.
  
 
=== Parameters ===
 
=== Parameters ===
'''func: ''' ''(function)'' Lua code to run in thread<br/>
+
'''func: ''' ''(function)'' Lua code to run in thread<br/>
  
 
=== Return values ===
 
=== Return values ===
'''ok: ''' ''(boolean)'' success or failure<br/>
+
'''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