Garry's Mod Wiki

Revision Difference

Global.DermaMenu#514778

<function name="DermaMenu" parent="Global" type="libraryfunc">⤶ <description>Creates a <page>DMenu</page> and closes any current menus.</description>⤶ <realm>Client and Menu</realm>⤶ <args>⤶ <arg name="parent" type="Panel">The panel to parent the created menu to.</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="Panel">The created <page>DMenu</page></ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Creates a DMenu with buttons to commit suicide or close it.</description>⤶ <code>⤶ 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()⤶ </code>⤶ <output></output>⤶ ⤶ </example>