GroupEnumUnitsOfType
- Parameters
whichGroup groupThe group to be modified.
unitname stringThe internal name of the unit definition to consider for adding units. For original unit definitions, this equals the
nameproperty inunits/unitui.slk, for custom unit definitions, it equals "custom_" + fourcc (e.g., "custom_h000").filter boolexprA filter function that is run for each considered unit.
- comment
Clears a group and then adds units of matching internal name to it.
- note
In contrast to spatial GroupEnum-functions, this function enumerates units with locust.
- note
Within the filter function, the considered unit can be accessed with
GetFilterUnit.- note
The filter function must return true (a truthy value in Lua) in order to add the unit to the group.
- note
If the filter function is
null(nilin Lua), all considered units will be added to the group.- note
The units are added consecutively to the group between filter runs, not in bulk after all filter runs were processed.
- note
In terms of running the filter function, units are processed in reverse order in which they were created on the map.
- note
Dependency equivalents are not considered. Querying Crypt Fiends ("cryptfiend") won't enumerate Burrowed Crypt Fiends ("cryptfiendmorph") and vice versa.
- patch
1.00
- Source
- common.j (suggest an edit or discuss on Github)
- return type
nothing- Source code
native GroupEnumUnitsOfType takes group whichGroup, string unitname, boolexpr filter returns nothing