Skip to main content

CreateSystemThread

This function was added in DSL 1

Description

Create a SYSTEM thread, using the same general rules as CreateThread.

These threads run while the game is paused or out of focus, before most parts of the game are updated each frame.

Any extra arguments (...) are passed to the thread function when the thread starts.

function CreateSystemThread(func, ...) --[[ ... ]] end

Parameters

  • func: function|string - 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 that will be passed to the thread function when it starts.

Return Values

  • thread: thread - The thread object representing the newly created system thread.

Example

local thread = CreateSystemThread(function(arg1, arg2)
print('Thread started with arguments:', arg1, arg2)
-- Perform background tasks here
end, 'Hello', 'World')

See Also