[Turn off line numbering]
1: arg gen, def, fltr, match;
2: var ancs, data, pp, p;
3:
4: if (!.has_flag('variables, sender()))
5: throw(~perm, sender() + " cannot read variables on " + this());
6: if (def)
7: ancs = [def];
8: else
9: ancs = .(gen[1])(gen[2]) || [this()];
10: data = [];
11: for pp in (data().to_list().reverse()) {
12: if (valid(pp[1]) && pp[1] in ancs) {
13: for p in (pp[2]) {
14: if (tostr(p[1]).(match)(fltr) != 0)
15: data += [[pp[1], @p]];
16: }
17: }
18: }
19: return data;
["// Created as a part of ColdCore, see: @help Credit"]