The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

LuaFileSystem
File System Library for the Lua Programming Language

Examples

Directory iterator

The following example iterates over a directory and recursively lists the attributes for each file inside it.

require"lfs"

function attrdir (path)
    for file in lfs.dir(path) do
        if file ~= "." and file ~= ".." then
            local f = path..'/'..file
            print ("\t "..f)
            local attr = lfs.attributes (f)
            assert (type(attr) == "table")
            if attr.mode == "directory" then
                attrdir (f)
            else
                for name, value in pairs(attr) do
                    print (name, value)
                end
            end
        end
    end
end

attrdir (".")

Valid XHTML 1.0!

$Id: examples.html,v 1.8 2007/12/14 15:28:04 carregal Exp $

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.