Tag groups are exposed by calling
mapthings.tagged(). Each function accepts a single parameter, which is the tag. For instance to fetch the sector tag group for tag 1...
Tag groups may be indexed (1-indexed) or called. You can also take the length of them, which tells the number of elements in the tag group. When a tag group is called it acts as an iterator. E.g.
for sector in sectors.tagged(1)
Tag lists are exposed from the
taglistfield of sectors, lines and mapthings. A tag list may be indexed (1-indexed), and the length be taken to tell the number of tags in the tag list. Since tag lists represent a map data structure, they will become invalid at the start of a new level. Therefore you should check the
validfield if you store the tag list.
Tag lists also inherit methods from the global
iterate(list)- returns an iterator over the tags in the tag list
has(list, tag)- returns a boolean of whether the tag exists in the list
shares(list, another_list)- returns a boolean of whether two lists share at least one tag
remove(list, tag)are also available for sector tag lists.
You may compare tag lists with an equality operator (
~=) to tell if two tag lists are composed of identical tags.
tagsis added to tell which tags are set in the level. This counts across sectors, lines and mapthings. Use
tags.iterateto iterate over these tags. You may also take the length of
tags, which will tell you how many unique tags are in use.
In addition to the Lua FEATURES, I've also fixed a bug where changing a sector's tag would shrink its original tag group incorrectly, leading to garbage elements at the end of the tag group.
mergedToggle commit list