Difference between revisions of "Thread:setFunction"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Sets a Lua function that thread will execute.
 
Sets a Lua function that thread will execute.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
ok = thread:setFunction(func)
 
ok = thread:setFunction(func)
</source>
+
</syntaxhighlight>
  
 
Will return false if the function cannot be set because the thread is currently running or suspended.
 
Will return false if the function cannot be set because the thread is currently running or suspended.

Latest revision as of 14: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