Arma 3 Scripting

isNull

  • Global argument
  • Arma 3 v0.50
  • First in Operation Flashpoint v1.00

Command · Markdown · JSON · original wiki page

Description

Checks whether the tested item is null.
Which null type the item has to be equal to depends on the type of game entity tested:

Type Object Group Control Display Location Task Script Config Diary Record Team Member
Null value objNull grpNull controlNull displayNull locationNull taskNull scriptNull configNull diaryRecordNull teamMemberNull
Since Operation Flashpoint v1.00 Armed Assault v1.00 Arma 2 v1.00 Arma 3 v1.30 Arma 3 v1.54 Arma 3 v2.00 Arma 3 v2.10

Important

A test via == does not work because a null value is not equal to anything, not even itself (configNull being the exception). See also isEqualTo.

Syntax

isNull entity

Parameters:

Returns: Boolean

Examples

Example 1

if (isNil "obj") exitWith { hint "obj variable is undefined" };

if (isNull obj) then
{
    hint "obj variable is defined but is null";
}
else
{
    hint "obj variable is defined and is not null";
};

Example 2

Diary Record support before Arma 3 v2.00:

private _nullRecord = objNull createDiaryRecord []; // wrong parameters = failure to create a record = null value
private _createdRecord = player createDiaryRecord ["Diary", ["title", "description"]];
if (_createdRecord isEqualTo _nullRecord) then { hint "Failed" };

Team Member support before Arma 3 v2.10:

private _isNull = _teamMember isEqualTo teamMemberNull;

See also

controlNull · displayNull · grpNull · locationNull · objNull · taskNull · teamMemberNull · scriptNull · configNull · typeName