forked from Simnation/Main
ed
This commit is contained in:
parent
875c8448e1
commit
c81ae4bb6d
219 changed files with 8036 additions and 7 deletions
27
resources/[tools]/bl_bridge/client/context/ox.lua
Normal file
27
resources/[tools]/bl_bridge/client/context/ox.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
local Context = {}
|
||||
local menu = exports.ox_lib
|
||||
|
||||
local function findHeader(data)
|
||||
for k, v in ipairs(data) do
|
||||
if v.isMenuHeader then
|
||||
return k, v.title
|
||||
end
|
||||
end
|
||||
return false, 'Header'
|
||||
end
|
||||
|
||||
---@param data ContextMenuProps | ContextMenuProps[]
|
||||
function Context.openContext(data)
|
||||
local id = require'utils'.await('UUID', false, 8)
|
||||
local index, header = findHeader(data)
|
||||
if index then table.remove(data, index) end
|
||||
menu:registerContext({id = id, title = header, options = data})
|
||||
menu:showContext(id)
|
||||
return id
|
||||
end
|
||||
|
||||
function Context.closeContext(onExit)
|
||||
menu:hideContext(onExit)
|
||||
end
|
||||
|
||||
return Context
|
Loading…
Add table
Add a link
Reference in a new issue