Skip to content
Tangent 128 edited this page Mar 28, 2015 · 3 revisions

SDL.createThread

Create a separate thread of execution. It is highly recommended to not discard the value of the function and to wait the thread before exiting.

You can pass optional parameters to the thread source except userdata and functions.

Function

SYNOPSIS

function SDL.createThread(name, path, ...)

ARGUMENTS

  • name, the thread name as a string
  • path, the path to the file
  • ..., the optional arguments passed to the file

RETURNS

  • a Thread object or nil
  • the error message

EXAMPLES

local t = SDL.createThread("name", "drawing.lua")

Function

SYNOPSIS

function SDL.createThread(name, func, ...)

ARGUMENTS

  • name, the thread name as a string
  • func, the function to be called
  • ..., the optional arguments passed to the file

RETURNS

  • a Thread object or nil
  • the error message

EXAMPLES

local function job()
while true do
print("...")
end
end

local t = SDL.createThread("name", job)
Clone this wiki locally