This AI is still in early stages of development.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Indicates a global was added by a script using the Define API.

 

Notes

A define with state Define.ADDED was originally missing, but has since been added using Define().

Added defines are immutable.

Note: If the define wasn't originally missing, the new define would have a state of Define.REPLACED.

Examples

Checking a specific state
// always use strict equality checks
if (Define("chat") === Define.ADDED) {
	// native chat function was missing, but was added by script
}
Using a switch statement to check state
// when using switch, order of cases is vitally important
switch (Define("chat")) {
	case Define.MISSING : return "chat() is missing";
	case Define.REMOVED : return "chat() was removed by script";
	case Define.ADDED   : return "chat() was added by script";
	case Define.REPLACED: return "chat() was overridden by script";
	case Define.NATIVE  : return "chat() function is native";
	default: return "Status of chat() is unknown";
}
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...

 

  • No labels