Revision Difference
DMenu:AddOption#513601
<function name="AddOption" parent="DMenu" type="panelfunc">⤶
<ispanel>yes</ispanel>⤶
<description>Add an option to the DMenu</description>⤶
<realm>Client</realm>⤶
<args>⤶
<arg name="name" type="string">Name of the option.</arg>⤶
<arg name="func" type="function" default="nil">Function to execute when this option is clicked.</arg>⤶
</args>⤶
<rets>⤶
<ret name="" type="Panel">Returns the created <page>DMenuOption</page> panel.</ret>⤶
</rets>⤶
</function>⤶
⤶
<example>⤶
<description>Creates a DMenu with 2 options: One that kills yourself; One that does nothing.</description>⤶
<code>⤶
local m = DermaMenu()⤶
⤶
m:AddOption( "Suicide", function() RunConsoleCommand("kill") end )⤶
m:AddOption( "It does nothing" )⤶
⤶
m:Open()⤶
</code>⤶
⤶
</example>