Garry's Mod Wiki

scripted_ents

The scripted_ents library allows you to access information about any scripted entities loaded into the game, as well as register your own entities.

Methods

scripted_ents.Alias( string alias, string classname )
Defines an alias string that can be used to refer to another classname
table scripted_ents.Get( string classname )
Returns a copy of the ENT table for a class, including functions defined by the base class This is used internally - although you're able to use it you probably shouldn't.
table scripted_ents.GetList()
Returns a copy of the list of all ENT tables registered
any scripted_ents.GetMember( string class, string name )
Retrieves a member of entity's table.
table scripted_ents.GetSpawnable()
Returns a list of all ENT tables which contain ENT. Spawnable
table scripted_ents.GetStored( string classname )
Returns the actual ENT table for a class. Modifying functions/variables in this table will change newly spawned entities
string scripted_ents.GetType( string classname )
Returns the 'type' of a class, this will one of the following: 'anim', 'ai', 'brush', 'point'.
boolean scripted_ents.IsBasedOn( string name, string base )
Checks if name is based on base
scripted_ents.OnLoaded()
This is used internally - although you're able to use it you probably shouldn't. Called after all ENTS have been loaded and runs baseclass. Set on each one. You can retrieve all the currently registered ENTS with scripted_ents. GetList. This is not called after an ENT auto refresh, and thus the inherited baseclass functions retrieved with baseclass. Get will not be updated
scripted_ents.Register( table ENT, string classname )
Registers an ENT table with a classname. Reregistering an existing classname will automatically update the functions of all existing entities of that class. Sub-tables provided in the first argument will not carry over their metatable, and will receive a BaseClass key if the table was merged with the base's. Userdata references, which includes Vectors, Angles, Entities, etc. will not be copied.