scripted_ents.Register

From Garry's Mod
Jump to: navigation, search
 scripted_ents.Register( )

Contents

Description

Registers an ENT table with a classname. Reregistering an existing classname will automatically update the functions of all existing entities of that class.

BUG

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.

Pull Request: #1300

Arguments

table ENT

The ENT table to register

Arguments

string classname

The classname to register

Examples

Example

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


Personal tools
Navigation