Returns whether the entity is a valid entity or not.
An entity is valid if:
Instead of calling this method directly, it's a good idea to call the global IsValid instead.
It will check whether the given variable contains an object (an Entity) or nothing at all for you. See examples.
This might be a cause for a lot of headache. Usually happening during networking etc., when completely valid entities suddenly become invalid on the client, but are never filtered with IsValid(). See GM:InitPostEntity for more details.
Shows how to use the global IsValid function instead of using this method directly.
- A lua error telling us 'ImportantGameData' is a nil value and thus can't perform math on it
But this shouldn't be possible, because we just created a value there. No red flags are present up until this point; all code up until this will run fine. Make sure to add an IsValid() check when the seemingly impossible happens.