Skip to content

Commit 369f15b

Browse files
committed
feat: further simplify of funcref check
1 parent d08d7bb commit 369f15b

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

shared/main.lua

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,7 @@ end
7070

7171
function QBShared.IsFunction(value)
7272
if type(value) == 'table' then
73-
local success = pcall(function()
74-
-- we just need to check if the table is indexable or not, this will simply return the error "cannot index a funcref"
75-
return value.__cfx_functionReference
76-
end)
77-
78-
return success
73+
return value.__cfx_functionReference ~= nil and type(value.__cfx_functionReference) == "string"
7974
end
8075

8176
return type(value) == 'function'

0 commit comments

Comments
 (0)