Method code for $list.match_object2()

[Turn on line numbering]
arg objs, str;
var obj, found;

found = [];
for obj in (objs) {
    if (type(obj) == 'frob && !valid(frob_class(obj)))
        (<$thing_frob, frob_value(obj)>).discard();
    else if (obj.match_name(str))
        found += [obj];
}
if (listlen(found) == 1)
    return found[1];
if (listlen(found) > 1)
    throw(~ambig, "ambiguous match", found);
throw(~objnf, "Object not found.");

// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit

Tlon