list.Set

From Garry's Mod
Jump to: navigation, search
 list.Set( )

Contents

Description

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

Arguments

string identifier

The list identifier

Arguments

any key

The key in the list to set

Arguments

any item

The item to set to the list as key

Examples

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


Examples

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


Personal tools
Navigation