Typesafe Promise implementation for Roblox Luau
Find a file
2022-01-02 23:49:56 -05:00
.github Create FUNDING.yml 2020-04-24 17:51:14 -04:00
docs Update docs for v4 2021-12-28 05:29:09 -05:00
lib Fix bug with Promise.fold 2022-01-02 23:18:12 -05:00
modules Update testez 2020-07-10 23:45:10 -04:00
.editorconfig Initial dump 2018-01-25 17:21:58 -08:00
.gitignore Move to selene from luacheck 2021-12-27 21:37:04 -05:00
.gitmodules Remove unused files 2020-05-04 22:07:36 -04:00
CHANGELOG.md Update CHANGELOG.md 2022-01-02 23:49:56 -05:00
default.project.json Fix default.project.json to allow usage as submodule (#29) 2021-03-19 18:50:11 -04:00
foreman.toml Create foreman.toml 2021-12-27 21:28:33 -05:00
LICENSE Update LICENSE 2019-09-10 00:29:21 -04:00
moonwave.toml Update discord server 2021-10-23 15:52:30 -04:00
README.md Remove code example from readme 2021-12-27 22:24:39 -05:00
rotriever.toml Release version 4.0.0-rc.2 2022-01-02 23:28:47 -05:00
runTests.server.lua Update testez 2020-05-04 22:07:55 -04:00
selene.toml Move to selene from luacheck 2021-12-27 21:37:04 -05:00
test.project.json Fix default.project.json to allow usage as submodule (#29) 2021-03-19 18:50:11 -04:00
testez.toml Move to selene from luacheck 2021-12-27 21:37:04 -05:00
wally.toml Release version 4.0.0-rc.2 2022-01-02 23:28:47 -05:00

Roblox Lua Promise

An implementation of Promise similar to Promise/A+.

View docs

Why you should use Promises

The way Roblox models asynchronous operations by default is by yielding (stopping) the thread and then resuming it when the future value is available. This model is not ideal because:

  • Functions you call can yield without warning, or only yield sometimes, leading to unpredictable and surprising results. Accidentally yielding the thread is the source of a large class of bugs and race conditions that Roblox developers run into.
  • It is difficult to deal with running multiple asynchronous operations concurrently and then retrieve all of their values at the end without extraneous machinery.
  • When an asynchronous operation fails or an error is encountered, Lua functions usually either raise an error or return a success value followed by the actual value. Both of these methods lead to repeating the same tired patterns many times over for checking if the operation was successful.
  • Yielding lacks easy access to introspection and the ability to cancel an operation if the value is no longer needed.

This Promise implementation attempts to satisfy these traits:

  • An object that represents a unit of asynchronous work
  • Composability
  • Predictable timing