mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:08:57 +00:00
feat: further simplify of funcref check
This commit is contained in:
+1
-6
@@ -70,12 +70,7 @@ end
|
|||||||
|
|
||||||
function QBShared.IsFunction(value)
|
function QBShared.IsFunction(value)
|
||||||
if type(value) == 'table' then
|
if type(value) == 'table' then
|
||||||
local success = pcall(function()
|
return value.__cfx_functionReference ~= nil and type(value.__cfx_functionReference) == "string"
|
||||||
-- we just need to check if the table is indexable or not, this will simply return the error "cannot index a funcref"
|
|
||||||
return value.__cfx_functionReference
|
|
||||||
end)
|
|
||||||
|
|
||||||
return success
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return type(value) == 'function'
|
return type(value) == 'function'
|
||||||
|
|||||||
Reference in New Issue
Block a user