(info) Other great resources: Official JS API docs, Scripting Forum

getLabel()

Get the label, if any, associated with a game object...

 

Syntax

var labelName = getLabel(object);

Parameters

ParameterTypeMandatoryNotesGame version
object

Game object

(tick)

The object to inspect.

3.2

Return value

ValueTypeNotesGame version
<labelName>String

If the object has a label, the name of the label will be returned.

If an object has multiple labels, only the first label found will be returned.

3.2
nullNullThe object is not labelled.3.2
<error>ErrorAn error occurred, most likely invalid parameters.3.2

Notes

Be careful not to call a variable "label" as that's also the name of a global function: label()

Example

var theLabel = getLabel(someObject);
This is a relatively slow operation of O(n) algorithmic complexity.
Availability 3.2+

Requires:

  • Warzone 3.2 or above
Contents

Jump to:

Scripting: Labels

Related Objects:

 Create them:

List them:

Retrieve their objects:

Monitor them:

Remove them: