Entity.GetParent

From GMod Wiki

Jump to: navigation, search
Function
Syntax Entity:GetParent( )
Description:
Returns the entity's parent entity.
Returns: Entity
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.GetParent]Entity.GetParent [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionFinds all props that are parented to something in the game and puts it to console.
Used onNewerShared.png
Code
for _, ent in pairs( ents.GetAll() ) do
	if ( ent:GetParent():IsValid() ) then
		print( "Entity at "..tostring( entity.GetPos() ).." is parented!")
	end
end
Output"Entity at 0 0 0 is parented!"


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox