(info) This AI is still in early stages of development.

Define.hasNative()

Check for presence of a native global property...

 

Syntax

var result = Define.hasNative(name);

Parameters

ParameterTypeMandatoryNotesAPI Version
nameString(tick)The name of the global object property to test.1.0

Return values

ValueTypeNotesAPI Version
trueBoolean

The named property is or was native.

Specifically it's state is either Define.NATIVE or Define.REPLACED.

1.0
falseBoolean

The named property is not native or does not exist.

Specifically it's sate is either Define.MISSING, Define.ADDED or Define.REMOVED.

1.0

Example

Check if we can use in-game chat...
if (Define.hasNative("chat")) {
	// use currently exposed chat() function
	// which is native if its state is Define.NATIVE
	// or replaced if its state is Define.REPLACED
	chat(0, "Let's chat...");
}
Force use of native implementation...
if (Define.hasNative("chat")) {
	// force use of native chat() function
	// https://warzone.atlassian.net/wiki/display/EGG/native
	native.chat(0, "Let's chat...");
}
Availability STABLE

Requires:

Contents

Jump to:

Define API

Topics:

  • Define()Add, remove or redefine a property on the global scope, overriding any native property of the same name on the global object...
  • Define API DiagnosticsDiagnostic routines for Define API...
  • Define ScriptsA library of ready made scripts for the Define API...