fix(callback): support __call metatables as cb function

Resolves #668.
This commit is contained in:
Linden committed 2025-01-20 02:10:09 +11:00
1 parent ebddb35b00
commit 99fb752d30
2 files changed
+8

No files matched your search

+4
View File
@@ -74,6 +74,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
+4
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