nil

From GMod Wiki

Revision as of 14:11, 5 December 2010 by SorryForN00B (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Nil.png

The value nil in lua means "nothing".

If a global variable or table index is set to nil, it will cease to exist.

If a function returns nothing, it returns nil.

In a condition, nil is equal to false.

When you run into NULL then remember, it is NOT nil.

If you are checking whether an entity exists or not then use either ValidEntity(Ent) or this condition "Ent and Ent:IsValid()". First check if it's nil then if it's valid.

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox