Directory helper
This is a helper to access/glob directory trees. It requires 'lfs' (lua filesystem).
Class functions
.new (path)
Create a new directory helper pointing at @path.
Methods
:glob (pattern)
Return an iterator to recursively find files matching @pattern@ in the directory. The pattern syntax is the same as string.match.
-- Find files ending in ".lua". for file in lk.Dir('lib'):glob '%.lua$' do print(file) end --> lib/lk/Dir.lua --> lib/lk/Doc.lua --> ...
:list ()
Return an iterator over the paths in the directory. The returned values are paths, not just filenames.
for file in lk.Dir('lib'):list() do print(file) end --> lib/lk --> lib/lk.lua
:contains (pattern)
Return true if there is at least one child in the directory that matches @pattern@.