Skip to content

Commit

Permalink
Update menu snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
KadDarem committed Jun 21, 2024
1 parent 8569e9d commit c2a0f2a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/jo_libs/modules/menu/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Your players will love the innovative features, including the grid layout, color

# Usage

[Download an example of menu resource](https://github.com/Jump-On-Studios/Documentation/tree/main/docs/public/snippets/menu)

## Constructor
##### Syntax
```lua
Expand Down
Binary file added docs/public/snippets/menu/snippet_menu.zip
Binary file not shown.
26 changes: 25 additions & 1 deletion docs/public/snippets/menu/snippet_menu/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ RegisterCommand('menu', function()
end)

function CreateMenu()
-------------
-- Initialize the menu
-------------
local menu = jo.menu.create('menu1',{
title = "My title",
subtitle = "The subtitle",
Expand All @@ -18,6 +21,10 @@ function CreateMenu()
end,
})

-------------
-- Add items in the menu
-------------

menu:addItem({
title = "Statistic Item",
statistics = {
Expand All @@ -38,8 +45,20 @@ function CreateMenu()
end
})

menu:addItem({
title="Go to child menu",
child = "subMenu"
})

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

-------------
-- Create a second menu
-------------

local subMenu = jo.menu.create('subMenu', {
title = "SubMenu",
onEnter = function()
Expand All @@ -66,8 +85,13 @@ function CreateMenu()
})
subMenu:send()


-------------
-- Define the current menu
-------------
jo.menu.setCurrentMenu('menu1',false,true)

-------------
-- Show the menu
-------------
jo.menu.show(true)
end

0 comments on commit c2a0f2a

Please sign in to comment.