Skip to main content

Promise.Then(function onFulfill, function onRejected = nil)

Associate handlers to called when promise if fulfilled or rejected. Note that the promise invokes the associated handlers in the main game thread; therefore, every API can be used safely within handlers.

Parameters:

NameTypeDescription
onFulfillfunctionHandler to be called when the promise fulfilled. The result of the promised passed as parameter to this function.
onRejectedfunctionThe handler to be called when the promise is rejected.

Returns:

typeDescription
Promiseitself.

Usage

---@type Promise
local promise;

---@type function
local onFulfill;

---@type function
local onRejected;


local val0 = promise.Then(onFulfill, onRejected)