Skip to content

Future

Inherits: Class

Methods

Cancel

lua
function Future:Cancel()

Marks the future as cancelled and cleans it up.

Done

lua
function Future:Done(value)

Marks the future as done with the specified result value.

Parameters:

NameTypeDescription
valueTThe result value

GetName

lua
function Future:GetName()
  -> string

Gets the name for debugging purposes.

Returns:

TypeDescription
string

GetValue

lua
function Future:GetValue()
  -> <T>

Gets the result value from a future in the done state.

Returns:

TypeDescription
<T>

IsDone

lua
function Future:IsDone()
  -> boolean

Returns whether or not the future is done.

Returns:

TypeDescription
boolean

SetScript

lua
function Future:SetScript(script, handler)

Registers a script handler.

Parameters:

NameTypeDescription
script"OnDone" | "OnCleanup"The script to register for
handlerfunctionThe script handler

Start

lua
function Future:Start()

Marks the future as started.

_Reset

lua
function Future:_Reset()

__init

lua
function Future:__init(name)

Parameters:

NameTypeDescription
name``

__tostring

lua
function Future:__tostring()

Functions

New

lua
function Future.New(name)
  -> Future

Create a new future.

Parameters:

NameTypeDescription
namestringThe name of the future for debugging purposes

Returns:

TypeDescription
Future