cachedItemList
This commit is contained in:
1 parent
2cb847c8cd
commit
58ab40d14e
2 files changed
+9
-2
No files matched your search
@@ -6,11 +6,14 @@ Callback = Callback or Require("lib/utility/shared/callbacks.lua")
|
|||||||
|
|
||||||
Framework = Framework or {}
|
Framework = Framework or {}
|
||||||
|
|
||||||
|
local cachedItemList = nil
|
||||||
-- This is an internal function, its here to attempt to emulate qbs shared items mainly.
|
-- This is an internal function, its here to attempt to emulate qbs shared items mainly.
|
||||||
Framework.ItemList = function()
|
Framework.ItemList = function()
|
||||||
|
if cachedItemList then return cachedItemList end
|
||||||
local items = Callback.Trigger('community_bridge:Callback:GetFrameworkItems', false)
|
local items = Callback.Trigger('community_bridge:Callback:GetFrameworkItems', false)
|
||||||
local fakeShared = { Items = items.Items or {} }
|
local fakeShared = { Items = items.Items or {} }
|
||||||
return fakeShared
|
cachedItemList = fakeShared
|
||||||
|
return cachedItemList
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get the name of the framework being used (if a supported framework).
|
---This will get the name of the framework being used (if a supported framework).
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ ESX = exports["es_extended"]:getSharedObject()
|
|||||||
|
|
||||||
Framework = Framework or {}
|
Framework = Framework or {}
|
||||||
|
|
||||||
|
local cachedItemList = nil
|
||||||
|
|
||||||
---This will return the name of the framework in use.
|
---This will return the name of the framework in use.
|
||||||
---@return string
|
---@return string
|
||||||
Framework.GetFrameworkName = function()
|
Framework.GetFrameworkName = function()
|
||||||
@@ -16,6 +18,7 @@ end
|
|||||||
|
|
||||||
-- This is an internal function, its here to attempt to emulate qbs shared items mainly.
|
-- This is an internal function, its here to attempt to emulate qbs shared items mainly.
|
||||||
Framework.ItemList = function()
|
Framework.ItemList = function()
|
||||||
|
if cachedItemList then return cachedItemList end
|
||||||
local items = ESX.Items
|
local items = ESX.Items
|
||||||
local repackedTable = {}
|
local repackedTable = {}
|
||||||
for k, v in pairs(items) do
|
for k, v in pairs(items) do
|
||||||
@@ -33,7 +36,8 @@ Framework.ItemList = function()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return { Items = repackedTable or {} }
|
cachedItemList = { Items = repackedTable or {} }
|
||||||
|
return cachedItemList
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return if the player is an admin in the framework.
|
---This will return if the player is an admin in the framework.
|
||||||
|
|||||||
Reference in new issue
Block a user