From the reference libraryRedM

autodoc_global_functions

jo_libs/modules/menu/autodoc/autodoc_global_functions.md

autodoc_global_functions

Constructor > <Badge type="client" text="Client" /> jo.menu.create() > Syntax

jo.menu.create(id, data)

Constructor > <Badge type="client" text="Client" /> jo.menu.create() > Parameters

id : string

Unique ID of the menu

data : table <BadgeOptional />

Menu configuration data

data.type : string - The type of menu tile or list <br> default tile

data.title : string - The big title of the menu The menu title <BadgeOptional />

data.subtitle : string - The subtitle of the menu The subtitle

data.numberOnScreen : integer - Only for list menu, Maximum number of items visibles at the same time <br> default : 8 <BadgeOptional />

data.numberOnLine : integer - Only for tile menu, Maximum number of items visibles at the same time <br> default : 4 <BadgeOptional />

data.numberLineOnScreen : integer - Only for tile menu, Maximum number of lines visibles at the same time <br> default : 6 <BadgeOptional />

data.distanceToClose : float - Distance at which the menu will self close if the player is moving away <br> default: false

data.displayBackButton : boolean - Whether to display the back button <br> default: false

data.onEnter : function - Fired when the menu is opened <BadgeOptional />

data.onBack : function - Fired when the backspace/Escape is pressed <BadgeOptional />

data.onExit : function - Fired when the menu is exited <BadgeOptional />

data.onTick : function - Fired every tick <BadgeOptional />

Constructor > <Badge type="client" text="Client" /> jo.menu.create() > Return Value

Type : MenuClass

The newly created menu object

Constructor > <Badge type="client" text="Client" /> jo.menu.create() > Example

--The unique ID of the menu
local id = "UniqueId1"
--The menu data
local data = {
  title = "Menu",        --The big title of the menu
  subtitle = "Elements", --The subtitle of the menu
  numberOnScreen = 8,    --The number of item display before add a scroll
  onEnter = function(currentData)
    print("Enter in menu " .. id)
  end,
  onBack = function(currentData)
    print("Backspace/Esc pressed in menu " .. id)
  end,
  onExit = function(currentData)
    print("Exit menu " .. id)
  end,
}
local menu = jo.menu.create(id, data)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:addItem()

Add an item to a menu <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:addItem() > Syntax

MenuClass:addItem(index, item)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:addItem() > Parameters

index : integer|table

Position index or item table if used as single parameter

[item](#item-methods) : table <BadgeOptional />

The item to add - if not provided, p is used as the item

[item](#item-methods).title : string - The item label

[item](#item-methods).child : string - The menu to open when Enter is pressed <br> default: false <BadgeOptional />

[item](#item-methods).visible : boolean - If the item is visible in the menu <br> default: true <BadgeOptional />

[item](#item-methods).data : table - Variable to store custom data in the item <BadgeOptional />

[item](#item-methods).description : string - Description text for the item <BadgeOptional />

[item](#item-methods).prefix : string - The little icon before the title from nui\menu\assets\images\icons folder prefix Icon <BadgeOptional />

[item](#item-methods).icon : string - The left icon filename from nui\menu\assets\images\icons folder Icon <BadgeOptional />

[item](#item-methods).iconRight : string - The right icon filename from nui\menu\assets\images\icons folder icon right <BadgeOptional />

[item](#item-methods).iconClass : string - CSS class for the icon <BadgeOptional />

[item](#item-methods).price : table - The price of the item. Use 0 to display "free" <br> default: false preview price <BadgeOptional />

[item](#item-methods).price.money : number - The price in $ <BadgeOptional />

[item](#item-methods).price.gold : number - The price in gold <BadgeOptional />

[item](#item-methods).priceTitle : string - Replace the "Price" label <BadgeOptional />

[item](#item-methods).priceRight : boolean - Display the price at the right of the item title price to the right <BadgeOptional />

[item](#item-methods).statistics : table - List of statistics to display for the item <BadgeOptional />

[item](#item-methods).disabled : boolean - If the item is disabled (grey) in the menu disable item <BadgeOptional />

[item](#item-methods).textRight : string - The label displayed at the right of the item Right text <BadgeOptional />

[item](#item-methods).previewPalette : boolean - Display a color square at the right of the item <br> default: true preview palette <BadgeOptional />

[item](#item-methods).sliders : table - List of sliders for the item <BadgeOptional />

[item](#item-methods).onActive : function - Fired when the item is selected <BadgeOptional />

[item](#item-methods).onClick : function - Fired when Enter is pressed on the item <BadgeOptional />

[item](#item-methods).onChange : function - Fired when a slider value changes <BadgeOptional />

[item](#item-methods).onExit : function - Fired when the item is exited <BadgeOptional />

[item](#item-methods).onTick : function - Fired every tick <BadgeOptional />

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:addItem() > Return Value

Type : MenuItemClass

The added item

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:addItem() > Example

-- Create a menu
local menu = jo.menu.create("shopMenu", {
  title = "General Store",
  subtitle = "Available Items"
})

-- Add items using single parameter (adds to the end of the list)
menu:addItem({
  title = "Hunting Knife",
  description = "A sharp knife for skinning animals",
  prefix = "knife", -- Icon before the title
  price = { money = 12.50 },
  statistics = {
    { label = "Damage", type = "bar", value = { 7, 10 } },
    { label = "Durability", type = "bar", value = { 8, 10 } }
  },
  onClick = function(currentData)
    print("Purchasing Hunting Knife")
    -- Code to purchase the item would go here
  end
})

-- Add item at specific position (position 1 - at the beginning)
menu:addItem(1, {
  title = "Horse Brush",
  description = "Keep your horse clean and happy",
  price = { money = 5.75 },
  icon = "brush",     -- Left icon
  disabled = false,
  textRight = "New!", -- Text shown on the right
  onClick = function(currentData)
    print("Purchasing Horse Brush")
    -- Code to purchase the item would go here
  end
})

-- Add another item with sliders
menu:addItem({
  title = "Hunting Outfit",
  description = "Camouflage clothing for hunting",
  price = { money = 45.00, gold = 5 },
  sliders = {
    {
      title = "Colors",
      current = 1,
      values = { "Brown", "Green", "Black" }
    }
  },
  onChange = function(currentData)
    local selectedColor = currentData.item.sliders[1].value.label
    print("Selected color: " .. selectedColor)
  end
})

-- Add a child menu item (opens another menu when selected)
menu:addItem({
  title = "Weapons →",
  child = "weaponsMenu", -- This will open the "weaponsMenu" when activated
  icon = "revolver"
})

-- Send the menu to the NUI layer
menu:send()

-- Set this menu as the current menu and show it
jo.menu.setCurrentMenu("shopMenu")
jo.menu.show(true)


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:deleteItem() > Syntax

MenuClass:deleteItem(index)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:deleteValue()

Delete a specific property of a menu. Requires MenuClass:push() to be called to apply the changes <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:deleteValue() > Syntax

MenuClass:deleteValue(keys)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:deleteValue() > Parameters

keys : string|table

The list of property name to access to the value

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:deleteValue() > Example

menu:deleteValue("key")

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:push()

Push the updated values to the NUI layer <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:push() > Syntax

MenuClass:push()

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:push() > Example

-- Update the title of the 3rd item in a menu
menu:updateValue({"items",3, "title"}, "New Title")
-- Update the NUI
menu:push()

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:refresh()

Refresh all the menu without changing the current state <br> Used when you want rebuild the menu <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:refresh() > Syntax

MenuClass:refresh()

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:refresh() > Example

local menu = jo.menu.create(id, data)
menu:addItem({ title = "Item 1" })
menu:send()
menu:addItem({ title = "Item 2" })
menu:refresh()


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:removeItem()

Remove an item from a menu by its index. Requires MenuClass:push() to be called to apply the changes <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:removeItem() > Syntax

MenuClass:removeItem(index)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:removeItem() > Parameters

index : integer

The index of the item to remove

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:removeItem() > Example

-- Remove the 2nd slider from the 1st item
menu:removeItem({"items", 1, "sliders", 2})
-- Update the NUI
menu:push()

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:reset()

Reset the menu to its initial state <br> Moves the cursor back to the first item <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:reset() > Syntax

MenuClass:reset()

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:reset() > Example

menu:reset()


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:send()

Send the menu data to the NUI layer <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:send() > Syntax

MenuClass:send()

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:send() > Example

local menu = jo.menu.create(id, data)
menu:send()


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:setCurrentIndex()

Change the current active item index <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:setCurrentIndex() > Syntax

MenuClass:setCurrentIndex(index)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:setCurrentIndex() > Parameters

index : integer

The item index to switch to

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:setCurrentIndex() > Example

local menu = jo.menu.create(id, data)

menu:addItem({
  title = "Item 1",
})

menu:addItem({
  title = "Item 2",
})

menu:addItem({
  title = "Item 3",
})

menu:setCurrentIndex(2) -- set item 2 as active


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:sort()

Sort menu items alphabetically by title <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:sort() > Syntax

MenuClass:sort(first, last)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:sort() > Parameters

first : integer <BadgeOptional />

Position of the first element to sort <br> default: 1

last : integer <BadgeOptional />

Position of the last element to sort <br> default: #self.[item](#item-methods)s

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:sort() > Example

-- Sort all menu items alphabetically by title
menu:sort()

-- Sort only items 2 through 5
menu:sort(2, 5)


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateItem()

<br> <br> Update a specific property of a menu item <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateItem() > Syntax

MenuClass:updateItem(index, key, value)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateItem() > Parameters

index : integer

The index of the item to update

key : string

The property name to update

value : any

The new value for the property

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateItem() > Example

-- Update the title of the second item
menu:updateItem(2, "title", "New Title")

-- Disable the third item
menu:updateItem(3, "disabled", true)


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateValue()

Update a specific property of a menu. Requires MenuClass:push() to be called to apply the changes <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateValue() > Syntax

MenuClass:updateValue(keys, value)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateValue() > Parameters

keys : string|table

The list of property name to access to the value

value : any

The new value

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateValue() > Return Value

Type : boolean

true if the update was successful, false otherwise

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateValue() > Example

-- Update the title of the 3rd item in a menu
menu:updateValue({"items",3, "title"}, "New Title")
-- Update the NUI
menu:push()

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:use()

Set this menu as the current active menu <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:use() > Syntax

MenuClass:use(keepHistoric, resetMenu)

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:use() > Parameters

keepHistoric : boolean <BadgeOptional />

Whether to keep navigation history <br> default: true

resetMenu : boolean <BadgeOptional />

Whether to reset the menu state <br> default: true

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:use() > Example

-- Set this menu as the current active menu
-- Keep navigation history and reset the cursor position
menu:use(true, true)

-- Set this menu as the current active menu
-- Don't keep navigation history
menu:use(false)

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:deleteValue()

Delete a specific property of a menu item. Requires MenuClass:push() to be called to apply the changes <br>

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:deleteValue() > Syntax

MenuItem:deleteValue(keys)

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:deleteValue() > Parameters

keys : string|table

The list of property name to access to the value

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:deleteValue() > Example

-- Remove the 2nd slider of the item
item:deleteValue({"sliders", 2})
-- Update the NUI
menu:push()

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:getParentMenu()

Get the parent menu of the item <br>

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:getParentMenu() > Syntax

MenuItem:getParentMenu()

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:getParentMenu() > Return Value

Type : MenuClass

The parent menu

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:getParentMenu() > Example

local parentMenu = item:getParentMenu()
print(parentMenu.title)

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:updateValue()

Update a specific property of a menu item. Requires MenuClass:push() to be called to apply the changes <br>

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:updateValue() > Syntax

MenuItem:updateValue(keys, value)

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:updateValue() > Parameters

keys : string|table

The property name to update

value : any

The new value for the property

MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:updateValue() > Example

-- Update the title of the 3rd slider of the item
item:updateValue({"sliders",3, "title"}, "New Title")
-- Update the NUI
menu:push()

item Methods > <Badge type="client" text="Client" /> item:getParentMenu() > Syntax

item:getParentMenu()

JO Functions > <Badge type="client" text="Client" /> jo.menu.addItem()

Add an item to a menu by its ID <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.addItem() > Syntax

jo.menu.addItem(id, p, item)

JO Functions > <Badge type="client" text="Client" /> jo.menu.addItem() > Parameters

id : string

The menu ID

p : integer|table

Position index or item table if used as single parameter

[item](#item-methods) : table <BadgeOptional />

The item to add - if not provided, p is used as the item

[item](#item-methods).title : string - The item label

[item](#item-methods).child : string - The menu to open when Enter is pressed <br> default: false <BadgeOptional />

[item](#item-methods).visible : boolean - If the item is visible in the menu <br> default: true <BadgeOptional />

[item](#item-methods).data : table - Variable to store custom data in the item <BadgeOptional />

[item](#item-methods).description : string - Description text for the item <BadgeOptional />

[item](#item-methods).prefix : string - The little icon before the title from nui\menu\assets\images\icons folder prefix Icon <BadgeOptional />

[item](#item-methods).icon : string - The left icon filename from nui\menu\assets\images\icons folder Icon <BadgeOptional />

[item](#item-methods).iconRight : string - The right icon filename from nui\menu\assets\images\icons folder icon right <BadgeOptional />

[item](#item-methods).iconClass : string - CSS class for the icon <BadgeOptional />

[item](#item-methods).price : table - The price of the item. Use 0 to display "free" <br> default: false preview price <BadgeOptional />

[item](#item-methods).price.money : number - The price in $ <BadgeOptional />

[item](#item-methods).price.gold : number - The price in gold <BadgeOptional />

[item](#item-methods).priceTitle : string - Replace the "Price" label <BadgeOptional />

[item](#item-methods).priceRight : boolean - Display the price at the right of the item title price to the right <BadgeOptional />

[item](#item-methods).statistics : table - List of statistics to display for the item <BadgeOptional />

[item](#item-methods).disabled : boolean - If the item is disabled (grey) in the menu disable item <BadgeOptional />

[item](#item-methods).textRight : string - The label displayed at the right of the item Right text <BadgeOptional />

[item](#item-methods).previewPalette : boolean - Display a color square at the right of the item <br> default: true preview palette <BadgeOptional />

[item](#item-methods).sliders : table - List of sliders for the item <BadgeOptional />

[item](#item-methods).onActive : function - Fired when the item is selected <BadgeOptional />

[item](#item-methods).onClick : function - Fired when Enter is pressed on the item <BadgeOptional />

[item](#item-methods).onChange : function - Fired when a slider value changes <BadgeOptional />

[item](#item-methods).onExit : function - Fired when the item is exited <BadgeOptional />

JO Functions > <Badge type="client" text="Client" /> jo.menu.addItem() > Example

-- Add a new item to a menu by its ID
local menuId = "mainMenu"
jo.menu.addItem(menuId, {
  title = "New Option",
  description = "This is a new menu option",
  onClick = function(currentData)
    print("New option clicked")
  end
})

-- Add a new item at a specific position (3rd position)
jo.menu.addItem(menuId, 3, {
  title = "Insert at position 3",
  description = "This item will be inserted at position 3"
})


JO Functions > <Badge type="client" text="Client" /> jo.menu.createIfNotExist()

Create a new menu if it doesn't exist <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.createIfNotExist() > Syntax

jo.menu.createIfNotExist(id, data)

JO Functions > <Badge type="client" text="Client" /> jo.menu.createIfNotExist() > Parameters

id : string

Unique ID of the menu

data : table <BadgeOptional />

Menu configuration data

JO Functions > <Badge type="client" text="Client" /> jo.menu.createIfNotExist() > Return Value

Type : boolean

Returns true if the menu was created


JO Functions > <Badge type="client" text="Client" /> jo.menu.delete() > Syntax

jo.menu.delete(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.delete() > Parameters

id : string

The menu ID to delete

JO Functions > <Badge type="client" text="Client" /> jo.menu.delete() > Example

local id = "UniqueId1"
jo.menu.delete(id)


JO Functions > <Badge type="client" text="Client" /> jo.menu.displayLoader() > Syntax

jo.menu.displayLoader(value)

JO Functions > <Badge type="client" text="Client" /> jo.menu.displayLoader() > Parameters

value : boolean <BadgeOptional />

Whether to display the loader <br> default: true

JO Functions > <Badge type="client" text="Client" /> jo.menu.displayLoader() > Example

jo.menu.displayLoader()
Wait(3000)
jo.menu.hideLoader()

JO Functions > <Badge type="client" text="Client" /> jo.menu.doesActiveButtonChange()

Check if the active button has changed since last update <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.doesActiveButtonChange() > Syntax

jo.menu.doesActiveButtonChange()

JO Functions > <Badge type="client" text="Client" /> jo.menu.doesActiveButtonChange() > Return Value

Type : boolean

Returns true if the active button has changed

JO Functions > <Badge type="client" text="Client" /> jo.menu.doesActiveButtonChange() > Example

-- Check if the selected button has changed since last update
if jo.menu.doesActiveButtonChange() then
  print("Player selected a different button")
end


JO Functions > <Badge type="client" text="Client" /> jo.menu.fireAllLevelsEvent()

Fire an event across all menu levels (current menu and current item) <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.fireAllLevelsEvent() > Syntax

jo.menu.fireAllLevelsEvent(eventName, ...)

JO Functions > <Badge type="client" text="Client" /> jo.menu.fireAllLevelsEvent() > Parameters

eventName : string

The name of the event to fire

... : any <BadgeOptional />

Additional arguments to pass to the event handlers

JO Functions > <Badge type="client" text="Client" /> jo.menu.fireAllLevelsEvent() > Example

-- Fire a custom event across all menu levels
jo.menu.fireAllLevelsEvent("onCustomEvent", "Parameter 1", 42, { data = "Extra data" })


JO Functions > <Badge type="client" text="Client" /> jo.menu.fireEvent()

Fire an event for a specific menu item <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.fireEvent() > Syntax

jo.menu.fireEvent(item, eventName, ...)

JO Functions > <Badge type="client" text="Client" /> jo.menu.fireEvent() > Parameters

[item](#item-methods) : table

The item to trigger the event on

eventName : string

The name of the event to fire

... : any <BadgeOptional />

Additional arguments to pass to the event handler

JO Functions > <Badge type="client" text="Client" /> jo.menu.fireEvent() > Example

-- Get the current item and fire a custom event on it
local currentItem = jo.menu.getCurrentItem()
jo.menu.fireEvent(currentItem, "onClick")

-- Fire a custom event on a specific menu
local menu = jo.menu.get("mainMenu")
jo.menu.fireEvent(menu, "onExit")


JO Functions > <Badge type="client" text="Client" /> jo.menu.forceBack()

Force the menu to go back to the previous menu <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.forceBack() > Syntax

jo.menu.forceBack()

JO Functions > <Badge type="client" text="Client" /> jo.menu.forceBack() > Example

-- Force the menu to go back to the previous menu
jo.menu.forceBack()


JO Functions > <Badge type="client" text="Client" /> jo.menu.get() > Syntax

jo.menu.get(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.get() > Parameters

id : string

The menu ID

JO Functions > <Badge type="client" text="Client" /> jo.menu.get() > Return Value

Type : MenuClass

The menu object

JO Functions > <Badge type="client" text="Client" /> jo.menu.get() > Example

-- Get a menu instance by its ID
local menuId = "mainMenu"
local menu = jo.menu.get(menuId)

-- Now you can work with this menu instance
if menu then
  print("Menu title: " .. menu.title)
  print("Number of items: " .. #menu.items)
end


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentData()

Get data about the current menu state <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentData() > Syntax

jo.menu.getCurrentData()

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentData() > Return Value

Type : table

Current menu data including menu ID and selected item

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentData() > Example

-- Get data about the current menu state
local currentData = jo.menu.getCurrentData()
print("Current menu ID: " .. tostring(currentData.menu))
print("Current item index: " .. tostring(currentData.index))


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentIndex()

A function to get the current index <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentIndex() > Syntax

jo.menu.getCurrentIndex()

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentIndex() > Return Value

Type : integer

The index of the current item

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentIndex() > Example

local currentIndex = jo.menu.getCurrentIndex()
print(currentIndex)

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentItem()

Get the currently selected menu item <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentItem() > Syntax

jo.menu.getCurrentItem()

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentItem() > Return Value

Type : table

The currently selected item

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentItem() > Example

-- Get the currently selected menu item
local currentItem = jo.menu.getCurrentItem()

-- Access properties of the current item
if currentItem then
  print("Selected item: " .. currentItem.title)
  if currentItem.description then
    print("Description: " .. currentItem.description)
  end
end


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenu() > Syntax

jo.menu.getCurrentMenu()

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenu() > Return Value

Type : MenuClass

The currently active menu

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenu() > Example

-- Get the currently active menu
local currentMenu = jo.menu.getCurrentMenu()

-- Access properties of the current menu
if currentMenu then
  print("Active menu title: " .. currentMenu.title)
  print("Number of items: " .. #currentMenu.items)
end


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenuId()

A function to get the current menu id <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenuId() > Syntax

jo.menu.getCurrentMenuId()

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenuId() > Return Value

Type : string

The id of the current menu

JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenuId() > Example

local currentMenuId = jo.menu.getCurrentMenuId()
print(currentMenuId)

JO Functions > <Badge type="client" text="Client" /> jo.menu.getPreviousData()

Get data about the previous menu state <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.getPreviousData() > Syntax

jo.menu.getPreviousData()

JO Functions > <Badge type="client" text="Client" /> jo.menu.getPreviousData() > Return Value

Type : table

Previous menu data including menu ID and selected item

JO Functions > <Badge type="client" text="Client" /> jo.menu.getPreviousData() > Example

-- Get data about the previous menu state
local previousData = jo.menu.getPreviousData()
print("Previous menu ID: " .. tostring(previousData.menu))
print("Previous item index: " .. tostring(previousData.index))


JO Functions > <Badge type="client" text="Client" /> jo.menu.hideLoader() > Syntax

jo.menu.hideLoader()

JO Functions > <Badge type="client" text="Client" /> jo.menu.hideLoader() > Example

jo.menu.displayLoader()
Wait(3000)
jo.menu.hideLoader()

JO Functions > <Badge type="client" text="Client" /> jo.menu.isCurrentMenu()

A function to know if the menu is the current one <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.isCurrentMenu() > Syntax

jo.menu.isCurrentMenu(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.isCurrentMenu() > Parameters

id : string

The menu id

JO Functions > <Badge type="client" text="Client" /> jo.menu.isCurrentMenu() > Return Value

Type : boolean

JO Functions > <Badge type="client" text="Client" /> jo.menu.isCurrentMenu() > Example

local menuId = "home"
local isCurrentMenu = jo.menu.isCurrentMenu(menuId)
print(isCurrentMenu)
-- Expected output: `true` if the "home" menu is active, else `false`

JO Functions > <Badge type="client" text="Client" /> jo.menu.isExist() > Syntax

jo.menu.isExist(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.isExist() > Parameters

id : string

the menu ID

JO Functions > <Badge type="client" text="Client" /> jo.menu.isExist() > Return Value

Type : boolean

Returns true if the menu exists

JO Functions > <Badge type="client" text="Client" /> jo.menu.isExist() > Example

local menuId = "home"
local isExist = jo.menu.isExist(menuId)
-- Expected output: `true` if the menu was created before, else `false`

JO Functions > <Badge type="client" text="Client" /> jo.menu.isOpen()

Check if any menu is currently open <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.isOpen() > Syntax

jo.menu.isOpen()

JO Functions > <Badge type="client" text="Client" /> jo.menu.isOpen() > Return Value

Type : boolean

Returns true if a menu is open

JO Functions > <Badge type="client" text="Client" /> jo.menu.isOpen() > Example

local isOpen = jo.menu.isOpen()
print(isOpen)


JO Functions > <Badge type="client" text="Client" /> jo.menu.isSoftHidden() > Syntax

jo.menu.isSoftHidden()

JO Functions > <Badge type="client" text="Client" /> jo.menu.missingMenuHandler()

<br> <br> Register a handler for missing menu error <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.missingMenuHandler() > Syntax

jo.menu.missingMenuHandler(id, callback)

JO Functions > <Badge type="client" text="Client" /> jo.menu.missingMenuHandler() > Parameters

id : string

The menu ID

callback : function

The handler function

JO Functions > <Badge type="client" text="Client" /> jo.menu.missingMenuHandler() > Example

jo.menu.missingMenuHandler('home', function()
  print('home menu is missing')
  local menu = jo.menu.create('home', {
    title = "home"
  })
  menu:addItem({title = "item"})
  menu:send()
  menu:use()
end)

JO Functions > <Badge type="client" text="Client" /> jo.menu.onChange()

Register a callback function for menu change events <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.onChange() > Syntax

jo.menu.onChange(cb)

JO Functions > <Badge type="client" text="Client" /> jo.menu.onChange() > Parameters

cb : function

The callback function to register

JO Functions > <Badge type="client" text="Client" /> jo.menu.onChange() > Example

-- Register a callback function for menu change events
jo.menu.onChange(function(currentData)
  print("Menu changed to: " .. tostring(currentData.menu))
  print("Selected item: " .. tostring(currentData.item.title))

  -- You can handle different menus here
  if currentData.menu == "mainMenu" then
    -- Do something specific for the main menu
  elseif currentData.menu == "settingsMenu" then
    -- Do something specific for the settings menu
  end
end)


JO Functions > <Badge type="client" text="Client" /> jo.menu.playAudio() > Syntax

jo.menu.playAudio(sound)

JO Functions > <Badge type="client" text="Client" /> jo.menu.playAudio() > Parameters

sound : string

JO Functions > <Badge type="client" text="Client" /> jo.menu.playAudio() > Example

jo.menu.playAudio('coins')

JO Functions > <Badge type="client" text="Client" /> jo.menu.refresh() > Syntax

jo.menu.refresh(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.refresh() > Parameters

id : string

The menu ID to refresh

JO Functions > <Badge type="client" text="Client" /> jo.menu.refresh() > Example

-- Refresh a menu by its ID to update its display
local menuId = "mainMenu"
jo.menu.refresh(menuId)


JO Functions > <Badge type="client" text="Client" /> jo.menu.reset() > Syntax

jo.menu.reset(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.reset() > Parameters

id : string

The menu ID to reset

JO Functions > <Badge type="client" text="Client" /> jo.menu.reset() > Example

-- Reset a menu by its ID
-- This moves the cursor back to the first item
local menuId = "mainMenu"
jo.menu.reset(menuId)


JO Functions > <Badge type="client" text="Client" /> jo.menu.runRefreshEvents()

A function to fire menu and items events <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.runRefreshEvents() > Syntax

jo.menu.runRefreshEvents(menuEvent, itemEvent)

JO Functions > <Badge type="client" text="Client" /> jo.menu.runRefreshEvents() > Parameters

menuEvent : boolean <BadgeOptional />

Whether to run menu events

[item](#item-methods)Event : boolean <BadgeOptional />

Whether to run item events

JO Functions > <Badge type="client" text="Client" /> jo.menu.runRefreshEvents() > Example

local fireMenuEvents = false
local fireItemEvents = true
jo.menu.runRefreshEvents(fireMenuEvents, fireItemEvents)

JO Functions > <Badge type="client" text="Client" /> jo.menu.send()

Send a menu to the NUI layer by its ID <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.send() > Syntax

jo.menu.send(id)

JO Functions > <Badge type="client" text="Client" /> jo.menu.send() > Parameters

id : string

The menu ID

JO Functions > <Badge type="client" text="Client" /> jo.menu.send() > Example

-- Send a menu to the NUI layer by its ID
local menuId = "mainMenu"
jo.menu.send(menuId)

-- Send without resetting cursor position
jo.menu.send(menuId, false)


JO Functions > <Badge type="client" text="Client" /> jo.menu.set() > Syntax

jo.menu.set(id, menu)

JO Functions > <Badge type="client" text="Client" /> jo.menu.set() > Parameters

id : string

The menu ID

menu : MenuClass

The menu object to set

JO Functions > <Badge type="client" text="Client" /> jo.menu.set() > Example

-- Create a new menu instance
local newMenu = {
  id = "customMenu",
  title = "Custom Menu",
  subtitle = "Created with jo.menu.set",
  items = {
    { title = "Option 1" },
    { title = "Option 2" }
  }
}

-- Set this as a menu by its ID
jo.menu.set("customMenu", newMenu)


JO Functions > <Badge type="client" text="Client" /> jo.menu.setCurrentMenu()

Set a menu as the current active menu <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.setCurrentMenu() > Syntax

jo.menu.setCurrentMenu(id, keepHistoric, resetMenu)

JO Functions > <Badge type="client" text="Client" /> jo.menu.setCurrentMenu() > Parameters

id : string

ID of the menu to activate

keepHistoric : boolean <BadgeOptional />

Keep the menu navigation history <br> default: true

resetMenu : boolean <BadgeOptional />

Clear and redraw the menu before displaying <br> default: true

JO Functions > <Badge type="client" text="Client" /> jo.menu.setCurrentMenu() > Example

local id = "UniqueId1"
local keepHistoric = true
local resetMenu = true
jo.menu.setCurrentMenu(id, keepHistoric, resetMenu)


JO Functions > <Badge type="client" text="Client" /> jo.menu.show() > Syntax

jo.menu.show(show, keepInput, hideRadar, animation, hideCursor)

JO Functions > <Badge type="client" text="Client" /> jo.menu.show() > Parameters

show : boolean

Whether to show or hide the menu

keepInput : boolean <BadgeOptional />

Whether to keep game input controls active <br> default: true

hideRadar : boolean <BadgeOptional />

Whether to hide the radar when menu is shown <br> default: true

animation : boolean <BadgeOptional />

Whether to use animation when showing/hiding the menu <br> default: true

hideCursor : boolean <BadgeOptional />

Whether to hide the cursor <br> default: false

JO Functions > <Badge type="client" text="Client" /> jo.menu.show() > Example

local visible = true
local keepInput = true
local hideRadar = true
jo.menu.show(visible, keepInput, hideRadar)


JO Functions > <Badge type="client" text="Client" /> jo.menu.softHide()

A function to hide temporary the menu and do action <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.softHide() > Syntax

jo.menu.softHide(cb, animation)

JO Functions > <Badge type="client" text="Client" /> jo.menu.softHide() > Parameters

cb : function

Action executed before show again the menu

animation : boolean <BadgeOptional />

Whether to use animation when showing/hiding the menu <br> default: true

JO Functions > <Badge type="client" text="Client" /> jo.menu.softHide() > Example

menu:addItem({
  title = "Title",
  onClick = function(currentData)
    jo.menu.softHide(function()
      local title = jo.input.native("Enter the new title", currentData.item.title, 100)
      if title then
        currentData.item.title = title
        menu:refresh()
      end
    end)
  end
})


JO Functions > <Badge type="client" text="Client" /> jo.menu.sort()

Sort menu items alphabetically by title using menu ID <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.sort() > Syntax

jo.menu.sort(id, first, last)

JO Functions > <Badge type="client" text="Client" /> jo.menu.sort() > Parameters

id : string

The menu ID

first : integer <BadgeOptional />

Position of the first element to sort <br> default: 1

last : integer <BadgeOptional />

Position of the last element to sort <br> default: #self.[item](#item-methods)s

JO Functions > <Badge type="client" text="Client" /> jo.menu.sort() > Example

-- Sort all items in a menu alphabetically by title
local menuId = "mainMenu"
jo.menu.sort(menuId)

-- Sort only items 2 through 5
jo.menu.sort(menuId, 2, 5)


JO Functions > <Badge type="client" text="Client" /> jo.menu.updateItem()

Update a specific property of a menu item by menu ID <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateItem() > Syntax

jo.menu.updateItem(id, index, key, value)

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateItem() > Parameters

id : string

The menu ID

index : integer

The index of the item to update

key : string

The property name to update

value : any

The new value for the property

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateItem() > Example

-- Update the title of the second item in a menu
local menuId = "mainMenu"
jo.menu.updateItem(menuId, 2, "title", "New Title")

-- Disable the third item
jo.menu.updateItem(menuId, 3, "disabled", true)


JO Functions > <Badge type="client" text="Client" /> jo.menu.updateLang() > Syntax

jo.menu.updateLang(lang)

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateLang() > Parameters

lang : table

List of translated strings

lang.of : string - The bottom right text displaying current item number <br> default : "%1 of %2" <BadgeOptional />

lang.selection : string - The "Selection" text <br> default : "Selection" <BadgeOptional />

lang.devise : string - The devise text <br> default : "$" <BadgeOptional />

lang.number : string - The number text <br> default : "Number %1" <BadgeOptional />

lang.free : string - The "Free" text <br> default : "Free" <BadgeOptional />

lang.variation : string - The variatio, text <br> default : "Variation" <BadgeOptional />

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateLang() > Example

-- Update menu language text
jo.menu.updateLang({
  of = "%1 of %2",
  selection = "Selection",
  devise = "$",
  number = "Number %1",
  free = "Free",
  variation = "Variation"
})


JO Functions > <Badge type="client" text="Client" /> jo.menu.updateVolume()

Set the volume level for menu sound effects <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateVolume() > Syntax

jo.menu.updateVolume(volume)

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateVolume() > Parameters

volume : number

Volume of sound effects 0.0 to 1.0

JO Functions > <Badge type="client" text="Client" /> jo.menu.updateVolume() > Example

-- Set the volume level for menu sound effects
-- Volume range is 0.0 to 1.0
jo.menu.updateVolume(0.8)


JO Functions > <Badge type="shared" text="Shared" /> jo.menu.formatPrice()

A function to format a single price <br>

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.formatPrice() > Syntax

jo.menu.formatPrice(price)

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.formatPrice() > Parameters

price : table|integer|number

The price to format

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.formatPrice() > Return Value

Type : table

The formatted price

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.formatPrice() > Example

local price = 10
local formattedPrice = jo.menu.formatPrice(price)
log(formattedPrice) -- Expected output: `{money = 10}`

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.formatPrices()

A function to format price variations <br>

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.formatPrices() > Syntax

jo.menu.formatPrices(prices)

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.formatPrices() > Parameters

prices : table|integer|number

The prices to format

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.formatPrices() > Return Value

Type : table

The formatted prices

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.formatPrices() > Example

local prices = {money = 10, operator = "and", gold = 20}
local formattedPrices = jo.menu.formatPrices(prices)
log(formattedPrices) -- Expected output: `{money = 10, gold = 20}`

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.isPriceFree() > Syntax

jo.menu.isPriceFree(price)

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.isPriceFree() > Parameters

price : table|integer|number

The price to check

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.isPriceFree() > Return Value

Type : boolean

Return true if the price is free

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.isPriceFree() > Example

local price = 10
local isFree = jo.menu.isPriceFree(price)
print(isFree) -- Expected output: `false`
price = {money = 0, bank = 0}
isFree = jo.menu.isPriceFree(price)
print(isFree) -- Expected output: `true`

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.mergePrices() > Syntax

jo.menu.mergePrices(...)

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.mergePrices() > Parameters

... : table

The prices to merge

JO Functions > <Badge type="shared" text="Shared" /> jo.menu.mergePrices() > Return Value

Type : table

The merged prices

JO Functions > <Badge type="client" text="Client" /> jo.menu.show() > Syntax

jo.menu.show(show, keepInput, hideRadar, playMenuAnimation, hideCursor)

JO Functions > <Badge type="client" text="Client" /> jo.menu.show() > Parameters

show : boolean

Whether to show or hide the menu

keepInput : boolean <BadgeOptional />

Whether to keep game input controls active <br> default: true

hideRadar : boolean <BadgeOptional />

Whether to hide the radar when menu is shown <br> default: true

playMenuAnimation : boolean <BadgeOptional />

Whether to use animation when showing/hiding the menu <br> default: true

hideCursor : boolean <BadgeOptional />

Whether to hide the cursor <br> default: false

JO Functions > <Badge type="client" text="Client" /> jo.menu.softHide() > Syntax

jo.menu.softHide(cb, playMenuAnimation, keepBackground)

JO Functions > <Badge type="client" text="Client" /> jo.menu.softHide() > Parameters

cb : function

Action executed before show again the menu

playMenuAnimation : boolean <BadgeOptional />

Whether to use animation when showing/hiding the menu <br> default: true

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateItem()

Update a specific property of a menu item <br>

JO Functions > <Badge type="client" text="Client" /> jo.menu.missingMenuHandler()

Register a handler for missing menu error <br>

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:addItem() > Parameters

index : integer|table

Position index or item table if used as single parameter

[item](#item-methods) : table <BadgeOptional />

The item to add - if not provided, p is used as the item

[item](#item-methods).title : string - The item label

[item](#item-methods).child : string - The menu to open when Enter is pressed <br> default: false <BadgeOptional />

[item](#item-methods).visible : boolean - If the item is visible in the menu <br> default: true <BadgeOptional />

[item](#item-methods).data : table - Variable to store custom data in the item <BadgeOptional />

[item](#item-methods).description : string - Description text for the item <BadgeOptional />

[item](#item-methods).prefix : string - The little icon before the title from nui\menu\assets\images\icons folder prefix Icon <BadgeOptional />

[item](#item-methods).icon : string - The left icon filename from nui\menu\assets\images\icons folder, or full image URL Icon <BadgeOptional />

[item](#item-methods).iconRight : string - The right icon filename from nui\menu\assets\images\icons folder icon right <BadgeOptional />

[item](#item-methods).iconClass : string - CSS class for the icon <BadgeOptional />

[item](#item-methods).price : table - The price of the item. Use 0 to display "free" <br> default: false preview price <BadgeOptional />

[item](#item-methods).price.money : number - The price in $ <BadgeOptional />

[item](#item-methods).price.gold : number - The price in gold <BadgeOptional />

[item](#item-methods).priceTitle : string - Replace the "Price" label <BadgeOptional />

[item](#item-methods).priceRight : boolean - Display the price at the right of the item title price to the right <BadgeOptional />

[item](#item-methods).statistics : table - List of statistics to display for the item <BadgeOptional />

[item](#item-methods).disabled : boolean - If the item is disabled (grey) in the menu disable item <BadgeOptional />

[item](#item-methods).textRight : string - The label displayed at the right of the item Right text <BadgeOptional />

[item](#item-methods).previewPalette : boolean - Display a color square at the right of the item <br> default: true preview palette <BadgeOptional />

[item](#item-methods).sliders : table - List of sliders for the item <BadgeOptional />

[item](#item-methods).onActive : function - Fired when the item is selected <BadgeOptional />

[item](#item-methods).onClick : function - Fired when Enter is pressed on the item <BadgeOptional />

[item](#item-methods).onChange : function - Fired when a slider value changes <BadgeOptional />

[item](#item-methods).onExit : function - Fired when the item is exited <BadgeOptional />

[item](#item-methods).onTick : function - Fired every tick <BadgeOptional />

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:addItem() > Return Value

Type : MenuItemClass

The added item


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:deleteValue() > Parameters

keys : string|table

The list of property name to access to the value


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:push() > Syntax

MenuClass:push()

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:refresh() > Syntax

MenuClass:refresh()

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:removeItem() > Parameters

index : integer

The index of the item to remove


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:reset() > Syntax

MenuClass:reset()

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:send() > Syntax

MenuClass:send()

MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:setCurrentIndex() > Parameters

index : integer

The item index to switch to


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:sort() > Parameters

first : integer <BadgeOptional />

Position of the first element to sort <br> default: 1

last : integer <BadgeOptional />

Position of the last element to sort <br> default: #self.[item](#item-methods)s


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateItem() > Parameters

index : integer

The index of the item to update

key : string

The property name to update

value : any

The new value for the property


MenuClass Methods > <Badge type="client" text="Client" /> MenuClass:updateValue() > Return Value

Type : boolean

true if the update was successful, false otherwise


MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:deleteValue() > Parameters

keys : string|table

The list of property name to access to the value


MenuItem Methods > <Badge type="client" text="Client" /> MenuItem:getParentMenu() > Return Value

Type : MenuClass

The parent menu


JO Functions > <Badge type="client" text="Client" /> jo.menu.addItem() > Parameters

id : string

The menu ID

p : integer|table

Position index or item table if used as single parameter

[item](#item-methods) : table <BadgeOptional />

The item to add - if not provided, p is used as the item

[item](#item-methods).title : string - The item label

[item](#item-methods).child : string - The menu to open when Enter is pressed <br> default: false <BadgeOptional />

[item](#item-methods).visible : boolean - If the item is visible in the menu <br> default: true <BadgeOptional />

[item](#item-methods).data : table - Variable to store custom data in the item <BadgeOptional />

[item](#item-methods).description : string - Description text for the item <BadgeOptional />

[item](#item-methods).prefix : string - The little icon before the title from nui\menu\assets\images\icons folder prefix Icon <BadgeOptional />

[item](#item-methods).icon : string - The left icon filename from nui\menu\assets\images\icons folder Icon <BadgeOptional />

[item](#item-methods).iconRight : string - The right icon filename from nui\menu\assets\images\icons folder icon right <BadgeOptional />

[item](#item-methods).iconClass : string - CSS class for the icon <BadgeOptional />

[item](#item-methods).price : table - The price of the item. Use 0 to display "free" <br> default: false preview price <BadgeOptional />

[item](#item-methods).price.money : number - The price in $ <BadgeOptional />

[item](#item-methods).price.gold : number - The price in gold <BadgeOptional />

[item](#item-methods).priceTitle : string - Replace the "Price" label <BadgeOptional />

[item](#item-methods).priceRight : boolean - Display the price at the right of the item title price to the right <BadgeOptional />

[item](#item-methods).statistics : table - List of statistics to display for the item <BadgeOptional />

[item](#item-methods).disabled : boolean - If the item is disabled (grey) in the menu disable item <BadgeOptional />

[item](#item-methods).textRight : string - The label displayed at the right of the item Right text <BadgeOptional />

[item](#item-methods).previewPalette : boolean - Display a color square at the right of the item <br> default: true preview palette <BadgeOptional />

[item](#item-methods).sliders : table - List of sliders for the item <BadgeOptional />

[item](#item-methods).onActive : function - Fired when the item is selected <BadgeOptional />

[item](#item-methods).onClick : function - Fired when Enter is pressed on the item <BadgeOptional />

[item](#item-methods).onChange : function - Fired when a slider value changes <BadgeOptional />

[item](#item-methods).onExit : function - Fired when the item is exited <BadgeOptional />


JO Functions > <Badge type="client" text="Client" /> jo.menu.delete() > Parameters

id : string

The menu ID to delete


JO Functions > <Badge type="client" text="Client" /> jo.menu.displayLoader() > Parameters

value : boolean <BadgeOptional />

Whether to display the loader <br> default: true


JO Functions > <Badge type="client" text="Client" /> jo.menu.doesActiveButtonChange() > Return Value

Type : boolean

Returns true if the active button has changed


JO Functions > <Badge type="client" text="Client" /> jo.menu.fireAllLevelsEvent() > Parameters

eventName : string

The name of the event to fire

... : any <BadgeOptional />

Additional arguments to pass to the event handlers


JO Functions > <Badge type="client" text="Client" /> jo.menu.fireEvent() > Parameters

[item](#item-methods) : table

The item to trigger the event on

eventName : string

The name of the event to fire

... : any <BadgeOptional />

Additional arguments to pass to the event handler


JO Functions > <Badge type="client" text="Client" /> jo.menu.forceBack() > Syntax

jo.menu.forceBack()

JO Functions > <Badge type="client" text="Client" /> jo.menu.get() > Return Value

Type : MenuClass

The menu object


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentData() > Return Value

Type : table

Current menu data including menu ID and selected item


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentIndex() > Return Value

Type : integer

The index of the current item


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentItem() > Return Value

Type : table

The currently selected item


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenu() > Return Value

Type : MenuClass

The currently active menu


JO Functions > <Badge type="client" text="Client" /> jo.menu.getCurrentMenuId() > Return Value

Type : string

The id of the current menu


JO Functions > <Badge type="client" text="Client" /> jo.menu.getPreviousData() > Return Value

Type : table

Previous menu data including menu ID and selected item


JO Functions > <Badge type="client" text="Client" /> jo.menu.hideLoader() > Syntax

jo.menu.hideLoader()

JO Functions > <Badge type="client" text="Client" /> jo.menu.isCurrentMenu() > Return Value

Type : boolean


JO Functions > <Badge type="client" text="Client" /> jo.menu.isExist() > Return Value

Type : boolean

Returns true if the menu exists


JO Functions > <Badge type="client" text="Client" /> jo.menu.isOpen() > Return Value

Type : boolean

Returns true if a menu is open


JO Functions > <Badge type="client" text="Client" /> jo.menu.missingMenuHandler() > Parameters

id : string

The menu ID

callback : function

The handler function


JO Functions > <Badge type="client" text="Client" /> jo.menu.onChange() > Parameters

cb : function

The callback function to register


JO Functions > <Badge type="client" text="Client" /> jo.menu.playAudio() > Parameters

sound : string


JO Functions > <Badge type="client" text="Client" /> jo.menu.refresh() > Parameters

id : string

The menu ID to refresh


JO Functions > <Badge type="client" text="Client" /> jo.menu.reset() > Parameters

id : string

The menu ID to reset


JO Functions > <Badge type="client" text="Client" /> jo.menu.runRefreshEvents() > Parameters

menuEvent : boolean <BadgeOptional />

Whether to run menu events

[item](#item-methods)Event : boolean <BadgeOptional />

Whether to run item events


JO Functions > <Badge type="client" text="Client" /> jo.menu.send() > Parameters

id : string

The menu ID


JO Functions > <Badge type="client" text="Client" /> jo.menu.set() > Parameters

id : string

The menu ID

menu : MenuClass

The menu object to set


JO Functions > <Badge type="client" text="Client" /> jo.menu.setCurrentMenu() > Parameters

id : string

ID of the menu to activate

keepHistoric : boolean <BadgeOptional />

Keep the menu navigation history <br> default: true

resetMenu : boolean <BadgeOptional />

Clear and redraw the menu before displaying <br> default: true


JO Functions > <Badge type="client" text="Client" /> jo.menu.show() > Parameters

show : boolean

Whether to show or hide the menu

keepInput : boolean <BadgeOptional />

Whether to keep game input controls active <br> default: true

hideRadar : boolean <BadgeOptional />

Whether to hide the radar when menu is shown <br> default: true

playMenuAnimation : boolean <BadgeOptional />

Whether to use animation when showing/hiding the menu <br> default: true

hideCursor : boolean <BadgeOptional />

Whether to hide the cursor <br> default: false


JO Functions > <Badge type="client" text="Client" /> jo.menu.softHide() > Parameters

cb : function

Action executed before show again the menu

playMenuAnimation : boolean <BadgeOptional />

Whether to use animation when showing/hiding the menu <br> default: true


JO Functions > <Badge type="client" text="Client" /> jo.menu.sort() > Parameters

id : string

The menu ID

first : integer <BadgeOptional />

Position of the first element to sort <br> default: 1

last : integer <BadgeOptional />

Position of the last element to sort <br> default: #self.[item](#item-methods)s


JO Functions > <Badge type="client" text="Client" /> jo.menu.updateItem() > Parameters

id : string

The menu ID

index : integer

The index of the item to update

key : string

The property name to update

value : any

The new value for the property


JO Functions > <Badge type="client" text="Client" /> jo.menu.updateLang() > Parameters

lang : table

List of translated strings

lang.of : string - The bottom right text displaying current item number <br> default : "%1 of %2" <BadgeOptional />

lang.selection : string - The "Selection" text <br> default : "Selection" <BadgeOptional />

lang.devise : string - The devise text <br> default : "$" <BadgeOptional />

lang.number : string - The number text <br> default : "Number %1" <BadgeOptional />

lang.free : string - The "Free" text <br> default : "Free" <BadgeOptional />

lang.variation : string - The variatio, text <br> default : "Variation" <BadgeOptional />


Back to documentation