mirror of
https://github.com/AmberGraceRblx/luau-promise.git
synced 2025-04-24 23:50:03 +00:00
Add some comments
This commit is contained in:
parent
17fac4d008
commit
d61ce8ed97
1 changed files with 8 additions and 0 deletions
|
@ -15,12 +15,20 @@ local function pack(...)
|
||||||
return len, { ... }
|
return len, { ... }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
Returns first value (success), and packs all following values.
|
||||||
|
]]
|
||||||
local function packResult(...)
|
local function packResult(...)
|
||||||
local result = (...)
|
local result = (...)
|
||||||
|
|
||||||
return result, pack(select(2, ...))
|
return result, pack(select(2, ...))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
Calls a non-yielding function in a new coroutine.
|
||||||
|
|
||||||
|
Handles errors if they happen.
|
||||||
|
]]
|
||||||
local function ppcall(callback, ...)
|
local function ppcall(callback, ...)
|
||||||
local co = coroutine.create(callback)
|
local co = coroutine.create(callback)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue