mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 22:22:46 +00:00
onExit information for context menu
This commit is contained in:
1 parent
f7e04d9119
commit
38a6df4b51
1 file changed
+12
-2
@@ -12,6 +12,7 @@ Used for registering a context menu.
|
|||||||
-- id: string
|
-- id: string
|
||||||
-- title: string
|
-- title: string
|
||||||
-- menu: string (optional)
|
-- menu: string (optional)
|
||||||
|
-- onExit: function (optional)
|
||||||
-- options: table
|
-- options: table
|
||||||
-- item: key as string or table
|
-- item: key as string or table
|
||||||
-- title: string (optional - if item isn't key)
|
-- title: string (optional - if item isn't key)
|
||||||
@@ -32,6 +33,7 @@ as you'd like.
|
|||||||
`title` - Every menu must have a title.
|
`title` - Every menu must have a title.
|
||||||
`menu` - Menu identifier - if defined there will be a back arrow next to the menu title
|
`menu` - Menu identifier - if defined there will be a back arrow next to the menu title
|
||||||
that will take you to the menu you defined.
|
that will take you to the menu you defined.
|
||||||
|
`onExit` - Function that will be ran when the user closes their context menu with ESC.
|
||||||
`options` - Contains all the clickable menu items.
|
`options` - Contains all the clickable menu items.
|
||||||
`item` - Defined as a key, can be empty if you don't want it to do anything.
|
`item` - Defined as a key, can be empty if you don't want it to do anything.
|
||||||
`item/title` - If not using keys then sets the title for the button.
|
`item/title` - If not using keys then sets the title for the button.
|
||||||
@@ -61,10 +63,15 @@ lib.showContext(id)
|
|||||||
```
|
```
|
||||||
|
|
||||||
### lib.hideContext
|
### lib.hideContext
|
||||||
Hides any currently visible context menu
|
Hides any currently visible context menu.
|
||||||
|
|
||||||
|
`onExit` param defines whether the onExit function for the
|
||||||
|
menu should be ran or not.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
lib.hideContext()
|
|
||||||
|
-- onExit: boolean
|
||||||
|
lib.hideContext(onExit)
|
||||||
```
|
```
|
||||||
|
|
||||||
### lib.getOpenContextMenu
|
### lib.getOpenContextMenu
|
||||||
@@ -89,6 +96,9 @@ RegisterCommand('testcontext', function()
|
|||||||
lib.registerContext({
|
lib.registerContext({
|
||||||
id = 'example_menu',
|
id = 'example_menu',
|
||||||
title = 'Example Context',
|
title = 'Example Context',
|
||||||
|
onExit = function()
|
||||||
|
print('Hello there')
|
||||||
|
end,
|
||||||
options = {
|
options = {
|
||||||
{title = 'Empty button'},
|
{title = 'Empty button'},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user