Skip to main content

CreateDrawingThread

This function was added in DSL 1

Description

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

These threads run directly before the game presents its back buffer, meaning anything you draw will be on top of everything the game drew.

This is useful for drawing custom UI elements, overlays, or any other graphical elements that need to be rendered on top of the game.

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

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

Parameters

  • func: function|string - The function to run in the drawing 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 drawing thread. This can be used to control the thread, such as pausing or stopping it.

Example

local thread = CreateDrawingThread(function()
while true do
-- Drawing operations go here
Wait(0) -- Yield to prevent blocking the main thread
end
end)

See Also