Revision Difference
undo.ReplaceEntity#548232
<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>
<file line="261-L282">lua/includes/modules/undo.lua</file>⤶
<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
undo.ReplaceEntity( entity, ragdoll )
cleanup.ReplaceEntity( entity, ragdoll )
end
</code>
</example>