Entity.IsValid
From GMod Wiki
Function | |
Syntax | Entity:IsValid( ) |
Description: | |
Returns true if the entity is really a valid entity. Does it exist? | |
Returns: | Boolean |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.IsValid]Entity.IsValid [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Additional Notes
- Alternatively you can use IsValid( ent ) and ValidEntity( ent ).
- Use this in code where it isn't known if the entity being altered is valid (real) or not. For example, in a timer that runs a function on a player. If the player leaves then your timer will fail without a validity check.