Garry's Mod Wiki

Revision Difference

null#561975

<cat>Dev.Lua</cat> <title>Concepts - NULL Entity</title> # NULL Entity `NULL` is an error value specific to Garry's Mod lua that represents an invalid <page>Entity</page>. 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 in the e⤶ These functions exist primarily to provide more meaningful error messages to the user and developer.⤶ See also <page>nil</page> <example> <description> In this example, we'll examine some of the behavior of `NULL` </description> <code> 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) </code> </example>