Garry's Mod Wiki

Garry's Mod Wiki

NULL Entity

NULL is an error value specific to Garry's Mod lua that represents an invalid Entity.

Unlike nil, which has no data type, NULL is an Entity and has the functions of an Entity defined on it.
If called, functions on NULL will either return error values or throw an error message.
These functions exist primarily to provide more meaningful error messages to the user and developer.

See also nil

Example

In this example, we'll examine some of the behavior of NULL

print( NULL == NULL ) -- true print( NULL == nil ) -- false print( isentity( NULL ) ) -- true print( NULL.GetPos ) -- function: 0x81991d7a (Or something similar) print( NULL:GetPos() ) -- [ERROR] XXX:XX: Tried to use a NULL entity! (Or something similar)

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...