Garry's Mod Wiki


  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.


1 table ENT
The ENT table to register.
2 string classname
The classname to register.


local ENT = scripted_ents.Get( "gmod_button" ) local oldUse = ENT.Use function ENT:Use( activator, caller, type, value ) print( tostring( self.Entity ) .. " just got pressed!" ) oldUse( self, activator, caller, type, value ) end scripted_ents.Register( ENT, "gmod_button" )