lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Tue, Sep 10, 2013 at 11:27 AM, David Demelier <demelier.david@gmail.com> wrote:

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.

My apologies for the double post.

--Andrew