Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Comment:
Migrated to Confluence 5.3
Excerpt |
---|
Returns a list of all currently defined labels... |
Syntax
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
// Warzone 3.1 Beta 3 and above var list = enumLabels(); // Warzone 3.2 and above var list = enumLabels([filter]); |
Parameters
The function has no parameters.Parameter | Type | Mandatory | Notes | Game version |
---|---|---|---|---|
filter | Constant | Optionally filter the list of labels by their associated object .type:
When specified, only label names associated with the specified object type will be returned. Default: No filter | 3.2 |
Return value
Value | Type | Description | Game version |
---|---|---|---|
<list> | Array of String | A list of label names currently registered with the JS API. Use label() (WZ 3.1) or getObject() (WZ 3.2+) to get the object associated with a label. | 3.1 Beta 3 |
[] | Empty Array | If there are no labels yet, or no labels matching the filter, an empty array is returned. | 3.1 Beta 3 |
Example
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
enumLabels().forEach( function getObjectFor(labelName) {
var obj = label(labelName); // retrieve object
if (obj) {
// do stuff with object
} else {
// there are no objects associated with this label
}
} ); |
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
enumLabels(AREA).forEach( function createListener(labelName) { this["eventArea"+labelName] = function(droid) { console("A droid entered AREA: "+labelName); } } ); |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Include Page | ||||
---|---|---|---|---|
|