From fbd11c52fa0cb017084fc22139c9c4581f89f3a5 Mon Sep 17 00:00:00 2001 From: zykem#0643 <86602828+Zykem@users.noreply.github.com> Date: Sun, 26 Oct 2025 15:34:48 +0100 Subject: [PATCH 1/2] refactor(lib/waitFor) Use verify instead of AssertType --- [core]/esx_lib/imports/waitFor/shared.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/[core]/esx_lib/imports/waitFor/shared.lua b/[core]/esx_lib/imports/waitFor/shared.lua index 31da0bfd..8202a1c6 100644 --- a/[core]/esx_lib/imports/waitFor/shared.lua +++ b/[core]/esx_lib/imports/waitFor/shared.lua @@ -10,13 +10,11 @@ xLib.waitFor = function(conditionFunc, errorMessage, timeoutMs) error("Timeout should be a positive number.") end - if not ESX.IsFunctionReference(conditionFunc) then - error("Condition Function should be a function reference.") - end + xLib.verify(conditionFunc, "function", true) -- since errorMessage is optional, we only validate it if the user provided it. if errorMessage then - ESX.AssertType(errorMessage, "string", "errorMessage should be a string.") + xLib.verify(errorMessage, "string", true) end local invokingResource = GetInvokingResource() From f4b951a173c5abde3f1cdacc9ff6e478ca443118 Mon Sep 17 00:00:00 2001 From: zykem#0643 <86602828+Zykem@users.noreply.github.com> Date: Sun, 26 Oct 2025 15:37:11 +0100 Subject: [PATCH 2/2] feat(lib/timeout) Type validation for cb function --- [core]/esx_lib/imports/timeout/shared.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/[core]/esx_lib/imports/timeout/shared.lua b/[core]/esx_lib/imports/timeout/shared.lua index c68eec04..e684f3a4 100644 --- a/[core]/esx_lib/imports/timeout/shared.lua +++ b/[core]/esx_lib/imports/timeout/shared.lua @@ -7,6 +7,8 @@ local CancelledTimeouts = {} ---@param cb function ---@return number xLib.timeout.setTimeout = function(msec, cb) + xLib.verify(cb, "function", true) + local id = TimeoutCount + 1 SetTimeout(msec, function()