Difference between revisions of "UISimpleMenu:Toggle"
From Nomad DB
(Created page with "Toggles a UISimpleMenu. == Syntax == == Key Binds == This function should be used for Key Binds, because it saves the menu's state. If you...") |
|||
Line 2: | Line 2: | ||
== Syntax == | == Syntax == | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | menu:Toggle() | ||
+ | </syntaxhighlight> | ||
== Key Binds == | == Key Binds == |
Latest revision as of 22:46, 16 April 2020
Toggles a UISimpleMenu.
Syntax
menu:Toggle()
Key Binds
This function should be used for Key Binds, because it saves the menu's state. If you use multiple sub-menus, it will open the last visible sub-menu. For more information about sub-menus and how they work, check out UISimpleMenu:AddButton.
Example
local menu = UI.SimpleMenu()
menu:SetTitle("Test Menu")
-- [ Menu Code ] --
ScriptHook.RegisterKeyHandler("openMenu", function()
menu:Toggle()
end)