From b5c7d4dc0b1dcefe73171e79a4e08ced5b3d8931 Mon Sep 17 00:00:00 2001 From: Andyyy7666 <86536434+Andyyy7666@users.noreply.github.com> Date: Fri, 27 Oct 2023 09:53:21 +0200 Subject: [PATCH] fix(shared/functions): isreosurcestarted errors --- shared/functions.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/functions.lua b/shared/functions.lua index a19c4cf..2464b0e 100644 --- a/shared/functions.lua +++ b/shared/functions.lua @@ -3,7 +3,8 @@ local startedResources = {} local function stateChanged(resourceName, state) local callbacks = startedResources[resourceName] if not callbacks then return end - for _, cb do + for i=1, #callbacks do + local cb = callbacks[i] cb(state) end end @@ -22,8 +23,7 @@ function NDCore.isResourceStarted(resourceName, cb) if not startedResources[resourceName] then startedResources[resourceName] = {} end - local invokingResource = GetInvokingResource() - startedResources[resourceName][invokingResource] = cb + startedResources[resourceName][#startedResources[resourceName]+1] = cb cb(started) end return started