Method code for $root.ancestors_to()

[Turn on line numbering]
arg checked, levels, maxlev;
var c, list;

list = [this()];
levels++;

// check parents
if (!maxlev || maxlev != levels) {
    for c in (.parents()) {
        list += [c.ancestors_to(checked, levels, maxlev)];
        checked = checked.setadd(c);
    }
}
return list;

["// Created as a part of ColdCore, see: @help Credit"]

the Cold Dark