GroupEnumUnitsOfType

Parameters
whichGroup group

The group to be modified.

unitname string

The internal name of the unit definition to consider for adding units. For original unit definitions, this equals the name property in units/unitui.slk, for custom unit definitions, it equals "custom_" + fourcc (e.g., "custom_h000").

filter boolexpr

A 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 (nil in 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
return type
nothing
Source code
native GroupEnumUnitsOfType                 takes group whichGroup, string unitname, boolexpr filter returns nothing