Forest Logo
search
package_2

async

By @nazumah

Roblox

Mirrored

Async

Wally License Luau

Async is a lightweight, high-performance Promise implementation for Luau on Roblox. It provides a robust architecture for handling asynchronous operations with full support for cancellation, chaining, and strict type safety.


Key Features

  • Extreme Type Safety: Designed to be the standard networking and async primitive for Kernel. It uses explicit type exports to ensure IntelliSense is never lost during require operations.
  • Robust Cancellation: Built-in onCancel hooks allow for deep cleanup of ongoing tasks (e.g., stopping a data fetch or clearing a buffer).
  • Collective Operations: Native support for Async.all, Async.race, Async.any, and Async.some to manage multiple concurrent tasks.
  • Thread Yielding: Seamlessly transition between async chains and standard Luau threads using :await() or :expect().

Installation

Wally

Update your wally.toml:

[dependencies]
Async = "nazumah/async@1.0.4"

Quick Start

1. Basic Async Creation

local Async = require(path.to.Async)

local function delayedMessage(msg: string)
    return Async.new(function(resolve, reject)
        task.wait(1)
        resolve(msg)
    end)
end

delayedMessage("Hello World"):andThen(print)

2. Handling Cancellation

local p = Async.new(function(resolve, reject, onCancel)
    local thread = task.delay(5, resolve, "Done")
    
    onCancel(function()
        task.cancel(thread)
        print("Async was cancelled!")
    end)
end)

p:cancel()

3. Usage inside Threads

local success, result = myAsync:await()
if success then
    print("Success:", result)
else
    warn("Failed:", result)
end

Documentation

  • Why Use Async?
  • API Reference

License

Licensed under the MIT License.

Package Details

Install command (Click to copy)


Version

1.0.4

License

MIT

check_circle

Safe for commercial use

infoLicense identified from the packaged LICENSE file; the manifest declared none.

Automated license review — not legal advice.