Garry's Mod Wiki

DermaMenu

  Panel DermaMenu( boolean keepOpen = false, Panel parent = nil )

Description

Creates a DMenu and closes any current menus.

Arguments

1 boolean keepOpen = false
If we should keep other DMenus open (true) or not (false).
2 Panel parent = nil
The panel to parent the created menu to.

Returns

1 Panel menu
The created DMenu.

Example

Creates a DMenu with buttons to commit suicide or close it.

local menu = DermaMenu() menu:AddOption( "Die", function() RunConsoleCommand( "kill" ) end ) menu:AddOption( "Close", function() print( "Close pressed" ) end ) -- The menu will remove itself, we don't have to do anything. menu:Open()
Output: