G.ValidEntity
From GMod Wiki
Revision as of 21:10, 25 August 2011 by Kamshak[NV] (Talk | contribs)
| Function | |
| Syntax |
ValidEntity( Entity entity ) Where is this used? |
| Description: | |
| Replaces Entity:IsValid() with a check to see if the supplied entity is nil before returning entity:IsValid(). | |
| Returns: | Boolean |
| Part of Library: | Global Functions |
| Realm: |
|
| BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=G.ValidEntity]G.ValidEntity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
| Description | This is how it is defined. It's in lua/includes/util.lua |
|---|---|
| Used on | |
| Code | function ValidEntity( object ) if (!object) then return false end return object:IsValid() end |
| Output | N/A |
| Description | An alternative to the function using shortcuts |
|---|---|
| Used on | |
| Code | function printValid( entEntity ) if entEntity and entEntity:IsValid( ) then print( "It's valid!" ) end end |
| Output | N/A |