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 } )

Page Links


Special Pages


Wikis

?

Render Time: 44ms

Session 0
DB GetPage 6
Generate Html 12
SaveChanges 15
Render Body 0
Render Sidebar 9