find("/directory/", "*bar",
function (entry)
-- Play with entry
end
)
David,
I wanted to add one more thought. If you do the above version, your user may wish to add additional arguments. So the argument list to "find" might be:
find( dir_str, patt, fun, ...)
The challenge with some APIs that do this is in "self". If fun is an object method, then "self" as the first argument can't happen, or it must happen.
This is why I tend to prefer for loops, even though map functions are cool.