I’ve created a native extension wrapper for the LuaFileSystem (LFS) library. LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution. LuaFileSystem offers a portable way to access the underlying directory structure and file attributes.
LFS offers quite a few useful functions, with the most important being the ability to read file attributes and iterate directories. Full API:
lfs.attributes (filepath [, aname | atable]) lfs.chdir (path) lfs.lock_dir(path, [seconds_stale]) lfs.currentdir () iter, dir_obj = lfs.dir (path) lfs.lock (filehandle, mode[, start[, length]]) lfs.link (old, new[, symlink]) lfs.mkdir (dirname) lfs.rmdir (dirname) lfs.setmode (file, mode) lfs.symlinkattributes (filepath [, aname]) lfs.touch (filepath [, atime [, mtime]]) lfs.unlock (filehandle[, start[, length]])
The extension contains an example that implements a simple file browser using some of the LFS functions: