Garry's Mod Wiki

DMenu:AddOption

  Panel DMenu:AddOption( string name, function func = nil )

Description

Add an option to the DMenu

Arguments

1 string name
Name of the option.
2 function func = nil
Function to execute when this option is clicked.
Function argument(s):
1 Panel pnl - The DMenuOption that was clicked.

Returns

1 Panel
Returns the created DMenuOption panel.

Example

Creates a DMenu with 2 options: One that kills yourself; One that does nothing.

local m = DermaMenu() m:AddOption( "Suicide", function() RunConsoleCommand("kill") end ) m:AddOption( "It does nothing" ) m:Open()