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

Function

isAsync

Server and clientTimersTrilogy Hub only

Checks whether the code is running inside an async task, i.e. whether it can wait with await or sleep without blocking.

Syntax

bool isAsync()

Returns

true inside an async task.

Example

local function saveAll()
    if not isAsync() then return async(saveAll) end
    sleep(100)
    print("zapisano")
end
saveAll()

See also