NULL

Description:
NULL
is kinda like nil
, but, nil
is used for everything in Lua, meanwhile NULL
is better to use only with CBaseEntity.NULL
in game code looks like this:
NULL = (CBaseEntity*)NULL
Why better use it only with entities
As writed above, NULL is just entity but invalid.And for checking is entity valid you can just use NULL global.
For KeyValues you should use NULL_KEYVALUES.
For scripted vgui you should use INVALID_PANEL and for HFont class INVALID_FONT.
Returns:
- 1) NULL
Example:
if ToBaseEntity(pEntity) ~= NULL then print( "Entity is definetly valid." ) endOr you can use this for preventing code from running if entity is not valid:
if ToBaseEntity(pEntity) == NULL then return end