mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 23:46:03 +01:00
feat(client/interface): allow replacing specific index in menu options
This commit is contained in:
@@ -24,8 +24,12 @@ function lib.showMenu(id)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function lib.setMenuOptions(id, options)
|
function lib.setMenuOptions(id, options, index)
|
||||||
registeredMenus[id].options = options
|
if index then
|
||||||
|
registeredMenus[id].options[index] = options
|
||||||
|
else
|
||||||
|
registeredMenus[id].options = options
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function lib.getOpenMenu() return openMenu end
|
function lib.getOpenMenu() return openMenu end
|
||||||
@@ -79,6 +83,7 @@ RegisterCommand('testMenu', function()
|
|||||||
{label = 'Nice 2', icon = {'fab', 'bitcoin'}},
|
{label = 'Nice 2', icon = {'fab', 'bitcoin'}},
|
||||||
{label = 'Nice 3', icon = 'biohazard', values={'option 1', 'option 2', 'option 3'}, defaultIndex = 2}
|
{label = 'Nice 3', icon = 'biohazard', values={'option 1', 'option 2', 'option 3'}, defaultIndex = 2}
|
||||||
})
|
})
|
||||||
|
lib.setMenuOptions('epic_menu', {label = 'Not nice'}, 1)
|
||||||
lib.showMenu('epic_menu')
|
lib.showMenu('epic_menu')
|
||||||
end,
|
end,
|
||||||
options = {
|
options = {
|
||||||
|
|||||||
Reference in New Issue
Block a user