OPX//77
CreatorsClient exports

OpenMenu

Last updated on

Opens an OPX menu owned by your resource on the local player's screen.

local res = exports.opx_infinity:OpenMenu(spec)

Sync. Every action on the menu reaches your reply export as opx:on:menu:action with the menu's action payload.

Parameters

  • spec: table — the menu spec without functions
    • owner, on and steal are set by OPX; any you pass are ignored.
    • Rows carry an id you read back as itemId.
    • A row with confirm = true (or { title, yes, no }) opens a two-row level, No, keep it first; your reply export gets the row's select only after the second row. See Confirm rows.
    • reply?: string — the export your answers go to; default CLIENT.EXPORTS.REPLY (OnOpxEvent)

Returns

  • { handle, id, nodes }

Errors

  • menu_busy (another owner's menu is open), spec errors such as invalid_items, export.callerDenied, export.badArgument, error.unavailable (module not running)
Example
local res = exports.opx_infinity:OpenMenu({
	title = 'NIGHT MARKET',
	closeOnSelect = true,
	items = {
		{ id = 'water', label = 'Water', value = '5 €$' },
		{ id = 'reset', label = 'Reset my stall', confirm = true },
	},
})
if not res.ok then print('menu refused: ' .. res.error) end

On this page

No Headings