Context Menu
Context Menu Usage Guide
Creating a Context Menu
To create a context menu, use the following function:
aty.createContext("Elevator", "Use the elevator.", {
name = "test_context",
position = "top-right",
title = "Elevator",
subtitle = "Use the elevator.",
selections = {
{
title = "Floors",
description = "Select the floor you want to go.",
icon = "fa-solid fa-elevator",
action = "submenu",
submenus = {
{
title = "Floor 1",
description = "Go to the first floor.",
icon = "fas fa-arrow-up",
action = "useElevator",
args = "first"
},
{
title = "Floor 2",
description = "Go to the second floor.",
icon = "fas fa-arrow-up",
action = "useElevator",
args = "second"
},
{
title = "Floor 3",
description = "Go to the third floor.",
icon = "fas fa-arrow-up",
action = "useElevator",
args = "third"
},
{
title = "Back",
description = "Go back to the main menu.",
icon = "fa-solid fa-caret-left",
action = "back"
}
}
},
{
title = 'Close Menu',
description = 'Test Description',
icon = 'fa-solid fa-circle-xmark',
action = 'close'
}
}
})
Context Menu Parameters
Name
"test_context"
A unique identifier for the context menu.
Type:string
Position
"top-right"
Determines where the context menu appears on the screen.
Options:"top-right","top-left","bottom-right","bottom-left", "bottom","top","left","right","center"
Type:string
Title
"Elevator"
The title displayed at the top of the context menu.
Type:string
Subtitle
"Use the elevator"
A brief description displayed below the title.
Type:string
Selections
Floors (Submenu Example)
- Title:
"Floors" - Description:
"Select the floor you want to go." - Icon:
"fa-solid fa-elevator" - Action:
"submenu"
Submenus
- Submenu Selection
- Title:
"Floor 1" - Description:
"Go to the first floor." - Icon:
"fas fa-arrow-up" - Action:
"useElevator" - Args:
"first"
- Title:
- Back
- Title:
"Back" - Description:
"Go back to the main menu." - Icon:
"fa-solid fa-caret-left" - Action:
"back"
- Title:
Close Menu
- Title:
"Close Menu" - Description:
"Test Description" - Icon:
"fa-solid fa-circle-xmark" - Action:
"close"
Icon References
Icons follow Font Awesome classes. Ensure the appropriate library is included in your project for the icons to render correctly.
This structure provides a detailed context menu with nested submenus, actions, and custom configurations for user interaction.
Open Context Menu
aty.openContext("test_context", function(cb)
TriggerEvent(cb.action, cb.args)
end)