Garry's Mod Wiki

Revision Difference

scripted_ents.GetStored#515857

<function name="GetStored" parent="scripted_ents" type="libraryfunc"> <description>Returns the actual ENT table for a class. Modifying functions/variables in this table will change newly spawned entities</description> <realm>Shared</realm> <args> <arg name="classname" type="string">The classname of the ENT table to return</arg> </args> <rets> <ret name="" type="table">entTable</ret> </rets> </function> ⤶ <example>⤶ <description>Modifies all newly spawned gmod_button's to print a message on use</description>⤶ <code>⤶ local ENT = scripted_ents.GetStored("gmod_button").t⤶ ⤶ {{Example⤶ | Description = Modifies all newly spawned gmod_button's to print a message on use⤶ | Code = local ENT = scripted_ents.GetStored("gmod_button").t⤶ local oldUse = ENT.Use function ENT:Use(activator, caller, type, value) print(tostring(self.Entity).." just got pressed!")⤶ ```⤶ ⤶ print(tostring(self.Entity).." just got pressed!")⤶ oldUse(self,activator, caller, type, value) end⤶ </code>⤶ ⤶ </example>```⤶ ⤶ end⤶ }}