undo.ReplaceEntity

From Garry's Mod
Jump to: navigation, search
 undo.ReplaceEntity( )

Contents

Description

Replaces any instance of the "from" reference with the "to" reference, in any existing undo block. Returns true if something was replaced

Arguments

Entity from

The old entity

Arguments

Entity to

The new entity to replace the old one

Returns

boolean

somethingReplaced

Examples

Example

When an entity is ragdolled, this will replace any instances of the entity with it's ragdoll.

function GM:CreateEntityRagdoll( entity, ragdoll )
 // Replace the entity with the ragdoll in cleanups etc
 undo.ReplaceEntity( entity, ragdoll )
 cleanup.ReplaceEntity( entity, ragdoll )
end


Personal tools
Navigation