1
0
Fork 0
forked from Simnation/Main
Main/resources/[tools]/bl_bridge/client/context/ox.lua
2025-08-04 04:28:47 +02:00

27 lines
No EOL
656 B
Lua

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