CountLivingPlayerUnitsOfTypeId
- Parameters
unitId integerwhichPlayer player- comment
- bug
Leaks handle
g: In Jass you must set local variables that hold agents (or any child type) tonullat the end of functions to avoid reference counter leaks.- patch
1.07
- Source
- Blizzard.j (suggest an edit or discuss on Github)
- return type
integer- Source code
function CountLivingPlayerUnitsOfTypeId takes integer unitId, player whichPlayer returns integer local group g local integer matchedCount set g = CreateGroup() set bj_livingPlayerUnitsTypeId = unitId call GroupEnumUnitsOfPlayer(g, whichPlayer, filterLivingPlayerUnitsOfTypeId) set matchedCount = CountUnitsInGroup(g) call DestroyGroup(g) return matchedCount endfunction