Denizen Script Tags


Tags are always written with a <between these marks>, and are critical to scripts, as the primary way to read data.
Learn about how tags work in The Beginner's Guide.


Showing 1 out of 2437 tags...
Name<MapTag.invert>
ReturnsMapTag
DescriptionReturns an inverted copy of the map. That is, keys become values and values become keys.
All values in the result will be ElementTags.
Note that the size of the result is not guaranteed to be the same as the input (as duplicate keys are not allowed, but duplicate values are).
In the case of duplicate new-keys, the last instance of the new-key will be preserved.
Example
# Narrates a map of '[1=a;2=b;3=c]'
- narrate <map[a=1;b=2;c=3].invert>
Example
# Demonstrates how duplicate values in the input become a single key in the output - narrates a map of '[1=a;2=c]'
- narrate <map[a=1;b=2;c=2].invert>
Sourcehttps://github.com/DenizenScript/Denizen-Core/blob/master/src/main/java/com/denizenscript/denizencore/objects/core/MapTag.java#L759