Typesafe Promise implementation for Roblox Luau
Find a file
2021-12-28 05:24:19 -05:00
.github Create FUNDING.yml 2020-04-24 17:51:14 -04:00
docs Fix broken links in docs 2021-09-23 19:10:22 -04:00
lib Cancel finally returned promise if outer cancelled 2021-12-28 05:24:19 -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 Release v3.2.0 2021-12-27 22:27:39 -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 v3.2.0 2021-12-27 22:27:39 -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 v3.2.0 2021-12-27 22:27:39 -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