IsUnitType(u, UNIT_TYPE_HERO) returns true if u is a hero.
function IsUnitHeroFilter takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO)
endfunction
function GetHeroGroup takes player p returns group
local filterfunc f = Filter(function IsUnitHeroFilter)
local group g = CreateGroup()
call GroupEnumUnitsOfPlayer(g, p, f)
call DestroyFilter(f)
return g
endfunction