diff options
author | Matthew Wild <mwild1@gmail.com> | 2021-03-25 15:08:22 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2021-03-25 15:08:22 +0000 |
commit | d1ccd87d551b9f10631eff3632801327aef0c09b (patch) | |
tree | a8ad09b4b5697beceab128f19b0ce50c7a77c40e /util | |
parent | fec0d44e89f58dae50063be87a6d9360e012f205 (diff) | |
download | prosody-d1ccd87d551b9f10631eff3632801327aef0c09b.tar.gz prosody-d1ccd87d551b9f10631eff3632801327aef0c09b.zip |
util.promise: Switch order of parameters to join()
This saves awkward fiddlery with varargs and also echoes the
signature of pcall/xpcall.
Diffstat (limited to 'util')
-rw-r--r-- | util/promise.lua | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/util/promise.lua b/util/promise.lua index 89bd1f26..ea30898c 100644 --- a/util/promise.lua +++ b/util/promise.lua @@ -146,12 +146,10 @@ local function all_settled(promises) end); end -local function join(...) +local function join(handler, ...) local promises, n = { ... }, select("#", ...); - local handler = promises[n]; - promises[n] = nil; return all(promises):next(function (results) - return handler(unpack(results, 1, n - 1)); + return handler(unpack(results, 1, n)); end); end |