G.ValidEntity

From GMod Wiki

Jump to: navigation, search
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: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.ValidEntity]G.ValidEntity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThis is how it is defined. It's in lua/includes/util.lua
Used onNewerShared.png
Code
function ValidEntity( object )
 
        if (!object) then return false end
        return object:IsValid()
 
end
OutputN/A


DescriptionAn alternative to the function using shortcuts
Used onNewerShared.png
Code
 
function printValid( entEntity )
    if entEntity and entEntity:IsValid( ) then
        print( "It's valid!" )
    end
end
OutputN/A
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox