Garry's Mod Wiki

Garry's Mod Wiki

  table constraint.GetAllConstrainedEntities( Entity ent, table resultTable = nil )

Description

Returns a table of all entities recursively constrained to an entitiy.

Arguments

1 Entity ent
The entity to check
2 table resultTable = nil
Table used to return result. Optional.

Returns

1 table
A table containing all of the constrained entities. This includes all entities constrained to entities constrained to the supplied entity, etc.

Example

Adapted from stools/remover.lua

-- Remove this entity and everything constrained function TOOL:RightClick( trace ) if ( !IsValid( trace.Entity ) or trace.Entity:IsPlayer() ) then return false end -- Loop through all the entities in the system for _, Entity in pairs( constraint.GetAllConstrainedEntities( trace.Entity ) ) do DoRemoveEntity( Entity ) end return true end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...