CreateThread
Description
This function was added in DSL 1
info
This function replaces the existing CreateThread
.
If DSL is not running or UseBaseGameScriptFunctions
was called with true
, the original function is used. Otherwise a GAME
thread is created and added to the current script. These threads run directly after the base game's.
When creating a DSL script, func
can be a string to refer to a function in the current script's environment. In this case, the name of the thread is also preserved to be shown in console messages or returned with GetThreadName
.
Any extra arguments (...
) are passed to the thread function when the thread starts.
function CreateThread(func, ...) --[[ ... ]] end
Parameters
func
-function
- The function to run in the thread. If a string is provided, it refers to a function in the current script's environment....
:any
- Optional. Additional arguments to pass to the thread function when it starts. These can be any Lua values, such as numbers, strings, tables, etc.
Return Values
thread
-thread
- The thread that was created. This can be used to control the thread, such as pausing or stopping it.
Example
CreateThread(function()
print("This is a thread running in DSL!")
end)
See Also
-
DSL
-
Game's Native