mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 03:01:31 +00:00
refactor(es_extended/client/functions): cache addon resource states
Cache addon resource states instead of checking it every time a function is called
This commit is contained in:
@@ -24,8 +24,15 @@ function ESX.GetPlayerData()
|
||||
return ESX.PlayerData
|
||||
end
|
||||
|
||||
local addonResourcesState = {
|
||||
['esx_progressbar'] = GetResourceState('esx_progressbar') ~= 'missing',
|
||||
['esx_notify'] = GetResourceState('esx_notify') ~= 'missing',
|
||||
['esx_textui'] = GetResourceState('esx_textui') ~= 'missing',
|
||||
['esx_context'] = GetResourceState('esx_context') ~= 'missing'
|
||||
}
|
||||
|
||||
local function IsResourceFound(resource)
|
||||
return GetResourceState(resource) ~= 'missing' or print(('[^1ERROR^7] ^5%s^7 is Missing!'):format(resource))
|
||||
return addonResourcesState[resource] or print(('[^1ERROR^7] ^5%s^7 is Missing!'):format(resource))
|
||||
end
|
||||
|
||||
function ESX.SearchInventory(items, count)
|
||||
|
||||
Reference in New Issue
Block a user