mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-19 16:06:02 +01:00
fix(radial): replace global item with same id instead of duplicating (#255)
This commit is contained in:
committed by
GitHub
parent
d72b7eb00a
commit
053d5d45ec
@@ -133,16 +133,28 @@ function lib.addRadialItem(items)
|
|||||||
local menuSize = #menuItems
|
local menuSize = #menuItems
|
||||||
local invokingResource = GetInvokingResource()
|
local invokingResource = GetInvokingResource()
|
||||||
|
|
||||||
if table.type(items) == 'array' then
|
items = table.type(items) == 'array' and items or { items }
|
||||||
for i = 1, #items do
|
|
||||||
local item = items[i]
|
for i = 1, #items do
|
||||||
item.resource = invokingResource
|
local item = items[i]
|
||||||
|
item.resource = invokingResource
|
||||||
|
|
||||||
|
if menuSize == 0 then
|
||||||
menuSize += 1
|
menuSize += 1
|
||||||
menuItems[menuSize] = item
|
menuItems[menuSize] = item
|
||||||
|
else
|
||||||
|
for j = 1, menuSize do
|
||||||
|
if menuItems[j].id == item.id then
|
||||||
|
menuItems[j] = item
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
if j == menuSize then
|
||||||
|
menuSize += 1
|
||||||
|
menuItems[menuSize] = item
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
items.resource = invokingResource
|
|
||||||
menuItems[menuSize + 1] = items
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if isOpen and not currentRadial then
|
if isOpen and not currentRadial then
|
||||||
|
|||||||
Reference in New Issue
Block a user