Entity.GetParent

From GMod Wiki

Revision as of 20:01, 29 October 2009 by Crazy Quebecer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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