mirror of
https://github.com/AmberGraceRblx/luau-promise.git
synced 2025-04-24 23:50:03 +00:00
Update to Promise version from Rojo, which changes await()
This commit is contained in:
parent
9bc03fc001
commit
7fb09d103f
1 changed files with 3 additions and 7 deletions
10
lib/init.lua
10
lib/init.lua
|
@ -221,15 +221,11 @@ function Promise:await()
|
||||||
local ok = bindable.Event:Wait()
|
local ok = bindable.Event:Wait()
|
||||||
bindable:Destroy()
|
bindable:Destroy()
|
||||||
|
|
||||||
if not ok then
|
return ok, unpack(result)
|
||||||
error(tostring(result[1]), 2)
|
|
||||||
end
|
|
||||||
|
|
||||||
return unpack(result)
|
|
||||||
elseif self._status == Promise.Status.Resolved then
|
elseif self._status == Promise.Status.Resolved then
|
||||||
return unpack(self._value)
|
return true, unpack(self._value)
|
||||||
elseif self._status == Promise.Status.Rejected then
|
elseif self._status == Promise.Status.Rejected then
|
||||||
error(tostring(self._value[1]), 2)
|
return false, unpack(self._value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue