We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The library currently checks for:
assert( successHandler == nil or type(successHandler) == "function", string.format(ERROR_NON_FUNCTION, "Promise:andThen") ) assert( failureHandler == nil or type(failureHandler) == "function", string.format(ERROR_NON_FUNCTION, "Promise:andThen") )
which will fail for callable tables that use the __call metamethod, so this code fails the assertion above:
local wrapped = {} setmetatable(wrapped, { __call = _wrapped, }) wrapped.cancel = _cancel Promise.new():andThen(wrapped, wrapped)
a helper method that could be used in the library might look like:
local function isCallable(value) if typeof(value) == "function" then return true end if typeof(value) == "table" then local mt = getmetatable(value) if mt and rawget(mt, "__call") then return true end end return false end
The text was updated successfully, but these errors were encountered:
Supporting callable tables sounds good to me. We should make sure that we update this behavior everywhere we check for things that are functions.
function
Sorry, something went wrong.
2943b69
Support callable tables where functions are allowed
4e04458
Closes #64
No branches or pull requests
The library currently checks for:
which will fail for callable tables that use the __call metamethod, so this code fails the assertion above:
a helper method that could be used in the library might look like:
The text was updated successfully, but these errors were encountered: