self:destroy
Shared
Destroys the promise instance and frees its resources
Syntax
local status = self:destroy()Destroying a pending promise will leave any threads awaiting it suspended indefinitely. Ensure the promise has been settled or no threads are awaiting it before calling this function.
- Settled promise — safe to destroy at any time.
- Pending promise with active waiters — awaiting threads will never resume.
Parameters
| No parameters are accepted by this function |
|---|
Returns
| Type | Name | Description |
|---|---|---|
bool | status | true on successful execution, false otherwise |
Examples
local entity = util.promise.create()
entity:resolve(true)
entity:destroy()