Skip to content

null

Literal

Absence of a value. nullptr is accepted as a synonym. Emits Luau nil.

Player ref = null;
if (player != null) { }

None.

The nil value.

nil

There is no C NULL macro. Compare with !=. guard (player != null) is the usual early-out.

Uninitialized locals (int coins;) also emit nil — always initialize.

Player playerRef = null;
guard (playerRef != null) else {
return;
}

Emits:

local playerRef: Player = nil
if not (playerRef ~= nil) then
return
end

optional · guard · instance-pointer