Skip to content

Commit

Permalink
fix return values and annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Bauumm committed Oct 25, 2024
1 parent 6514631 commit da1a899
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions async.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
-- small async implementation using coroutines to suspend a function awaiting a callback

---@class promise
---@field done_callbacks table
---@field error_callbacks table
---@field executed boolean
---@field result any
---@field resolved boolean
---@private done_callbacks table
local promise = {}
promise.__index = promise
Expand Down Expand Up @@ -56,7 +60,7 @@ function promise:done(callback)
error("Uncaught error in done callback of promise")
end, unpack(self.result))
end
return
return self
end
self.done_callbacks[#self.done_callbacks + 1] = callback
return self
Expand All @@ -74,7 +78,7 @@ function promise:err(callback)
error("Uncaught error in promise")
end, unpack(self.result))
end
return
return self
end
self.error_callbacks[#self.error_callbacks + 1] = callback
return self
Expand Down

0 comments on commit da1a899

Please sign in to comment.