Defines the client-side cw.menuitems library, the list of tabs shown in the main menu.

A tab is a text, a panel class, a tooltip and icon data, added with cw.menuitems:Add.

Summary

Methods

Adds a tab to the main menu.
Removes a main menu tab by its text.
Get(text)client
Returns a main menu tab by its text.

Methods

cw.menuitems:Add(text, panel, tip, iconData)

client gamemodes/catwork/gamemode/core/libraries/cl_menuitems.lua:35

Adds a tab to the main menu.

The list is rebuilt whenever the menu is created, so call this from the MenuItemsAdd hook. Tabs are sorted by text.

function PLUGIN:MenuItemsAdd(menuItems)
  menuItems:Add('#Combine_PDA', 'cwCombinePDA', '#Combine_PDA_Desc', { path = 'fa-mobile', size = 10 })
end

Parameters

  • text String Text of the tab button, or a language phrase
  • panel String VGUI class name of the panel the tab opens
  • tip String Tooltip of the button, or a language phrase
  • iconData Map Icon of the button: path (a Font Awesome icon name) and optional size

See also

Removes a main menu tab by its text.

Call this from the MenuItemsDestroy hook.

Parameters

  • text String Text of the tab

Returns a main menu tab by its text.

Parameters

Returns

  • Map The menu item (text, panel, tip, iconData), or nil if there is none

Defined in