mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
fix(init): initial cache index returns full table
This commit is contained in:
10
init.lua
10
init.lua
@@ -152,7 +152,7 @@ local ox = GetResourceState('ox_core') ~= 'missing' and setmetatable({}, {
|
|||||||
|
|
||||||
local cache_mt = {
|
local cache_mt = {
|
||||||
__index = function(self, key)
|
__index = function(self, key)
|
||||||
return rawset(self, key, exports[lualib]['cache'](nil, key) or false)
|
return rawset(self, key, exports[lualib]['cache'](nil, key) or false)[key]
|
||||||
end,
|
end,
|
||||||
|
|
||||||
__call = function(self)
|
__call = function(self)
|
||||||
@@ -186,11 +186,11 @@ end)
|
|||||||
|
|
||||||
AddEventHandler('lualib:updateCache', function(data)
|
AddEventHandler('lualib:updateCache', function(data)
|
||||||
for key, value in pairs(data) do
|
for key, value in pairs(data) do
|
||||||
if lib.onCache[key] then
|
|
||||||
lib.onCache[key](value, cache[key])
|
|
||||||
end
|
|
||||||
|
|
||||||
cache[key] = value
|
cache[key] = value
|
||||||
|
|
||||||
|
if lib.onCache[key] then
|
||||||
|
lib.onCache[key](value)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user