From 5392f38c7a080f676693e204f3e46da25ae1f45b Mon Sep 17 00:00:00 2001 From: Ilias Rbayti <63159154+Kenshiin13@users.noreply.github.com> Date: Wed, 27 Nov 2024 21:36:54 +0100 Subject: [PATCH] feat(es_extended/shared/functions): add ESX.IsFunctionReference --- [core]/es_extended/shared/functions.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/[core]/es_extended/shared/functions.lua b/[core]/es_extended/shared/functions.lua index fc342bce..1a5d0090 100644 --- a/[core]/es_extended/shared/functions.lua +++ b/[core]/es_extended/shared/functions.lua @@ -164,3 +164,10 @@ function ESX.AssertType(...) return matches end + +---@param val unknown +function ESX.IsFunctionReference(val) + local typeVal = type(val) + + return typeVal == "function" or (typeVal == "table" and type(getmetatable(val)?.__call) == "function") +end \ No newline at end of file