Garry's Mod Wiki

Revision Difference

undo.ReplaceEntity#515919

<function name="ReplaceEntity" parent="undo" type="libraryfunc"> <description>Replaces any instance of the "from" reference with the "to" reference, in any existing undo block. Returns true if something was replaced</description> <realm>Server</realm> <args> <arg name="from" type="Entity">The old entity</arg> <arg name="to" type="Entity">The new entity to replace the old one</arg> </args> <rets> <ret name="" type="boolean">somethingReplaced</ret> </rets> </function> ⤶ <example>⤶ <description>When an entity is ragdolled, this will replace any instances of the entity with it's ragdoll.</description>⤶ <code>⤶ function GM:CreateEntityRagdoll( entity, ragdoll )⤶ // Replace the entity with the ragdoll in cleanups etc ⤶ {{Example⤶ | Description = When an entity is ragdolled, this will replace any instances of the entity with it's ragdoll.| Code = function GM:CreateEntityRagdoll( entity, ragdoll )⤶ ```⤶ // Replace the entity with the ragdoll in cleanups etc undo.ReplaceEntity( entity, ragdoll ) cleanup.ReplaceEntity( entity, ragdoll ) end⤶ </code>⤶ ⤶ </example>```⤶ ⤶ end⤶ }}