Browse Source

Added Unit.GetRecursive()

Dmitry Yu Okunev 4 years ago
parent
commit
31f6844ab9
1 changed files with 7 additions and 0 deletions
  1. 7 0
      unit.go

+ 7 - 0
unit.go

@@ -198,6 +198,13 @@ func (units Units) GetRecursive() (result UnitPtrs) {
 	}, nil)
 	return
 }
+func (unit Unit) GetRecursive() (result UnitPtrs) {
+	unit.DoRecursive(func(unit *Unit, arg interface{}) bool {
+		result = append(result, unit)
+		return true
+	}, nil)
+	return
+}
 
 func (u Unit) GetChildrenPtrs() []*Unit {
 	if !u.childrenReady {