From da1a899d95e6f496dd53d3bc1c4a4f547e2f23ba Mon Sep 17 00:00:00 2001 From: Bauumm Date: Sat, 21 Sep 2024 17:04:36 +0200 Subject: [PATCH] fix return values and annotations --- async.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/async.lua b/async.lua index 7b9057c..b12ea8b 100644 --- a/async.lua +++ b/async.lua @@ -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 @@ -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 @@ -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