Garry's Mod Wiki

list.Set

  list.Set( string identifier, any key, any item )

Description

Sets a specific position in the named list to a value.

Arguments

1 string identifier
The list identifier
2 any key
The key in the list to set
3 any item
The item to set to the list as key

Example

Adds an NPC to the spawnmenu NPC list with the name "Fisherman", classname of "npc_fisherman" and the default weapon of "weapon_oldmanharpoon"

-- Lost Coast list.Set("NPC", "npc_fisherman", { Name = "Fisherman", Class = "npc_fisherman", Weapons = { "weapon_oldmanharpoon" }, Category = Category })

Example

Adds a new "Desktop Widget" to the Context Menu (C Menu). (This is how Player Model selection is added)

list.Set( "DesktopWindows", "My Custom Context Menu Icon", { title = "Context Menu Icon", icon = "icon64/icon.png", init = function( icon, window ) --Your code here end } )