ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. getTaskStatus

Function

getTaskStatus

Server and clientTimersTrilogy Hub only

Returns the state of a task from async: "running" (waiting or working), "done" (finished) or "failed" (error). After the state it returns the values returned by the task function or, for "failed", the error message.

Syntax

string, ... getTaskStatus(task task)

Arguments

tasktask
A task from async.

Returns

The state and the task's results.

Example

local task = async(function()
    sleep(500)
    return 42
end)
setTimer(function()
    print(getTaskStatus(task))  -- done  42
end, 1000, 1)

See also