fix(callback): support __call metatables as cb function

Resolves #668.
This commit is contained in:
Linden
2025-01-20 02:10:02 +11:00
parent ebddb35b00
commit 99fb752d30
2 changed files with 8 additions and 0 deletions

View File

@@ -57,6 +57,10 @@ lib.callback = setmetatable({}, {
else
local cbType = type(cb)
if cbType == 'table' and getmetatable(cb)?.__call then
cbType = 'function'
end
assert(cbType == 'function', ("expected argument 3 to have type 'function' (received %s)"):format(cbType))
end