[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Init system in Lua
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 17 Nov 2011 12:40:28 +0200
On Thu, Nov 17, 2011 at 12:29 PM, Natanael Copa <natanael.copa@gmail.com> wrote:
> sh.find({ name = "*.lua" }, function(path)
> print("luafile found:", path)
> end)
>
> or:
>
> for path in sh.find{name = "*.lua"} do
> print("Lua file found:", path)
> end
Ah, APIs always involve these interesting decisions! Both have their
benefits, and it's always possible to write variants that support both
'internal' and 'external' iterator styles.
Right - so the idea is to minimize subprocess creation as much as
possible. With the luafilesystem/luaposix dir iterators that file
search can be done, but copying files is somewhat tricky. (At least
in Penlight I just use 'cp' on POSIX because otherwise I'd need
luaposix to sort out the permissions etc; on Windows, there's a copy
file function which I use.)
steve d.