Garry's Mod Wiki

spawnmenu.AddContentType

spawnmenu.AddContentType( string name, function constructor )

Description

Registers a new content type that is saveable into spawnlists. Created/called by spawnmenu.CreateContentIcon.

Arguments

1 string name
An unique name of the content type.
2 function constructor
A function that is called whenever we need create a new panel for this content type.

It has two arguments:

Panel container - The container/parent of the new panel

table data - Data for the content type passed from spawnmenu.CreateContentIcon

Example

A simple header content type.

spawnmenu.AddContentType( "header", function( container, obj ) if ( !obj.text or type(obj.text) != "string" ) then return end local label = vgui.Create( "ContentHeader", container ) label:SetText( obj.text ) container:Add( label ) end )

Page Links


Special Pages


Wikis

?

Render Time: 45ms

DB GetPage 4
Generate Html 11
SaveChanges (1) 8
Render Body 0
Render Sidebar 19