lua-users home
lua-l archive

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

To Whom It May Entertain:

Another functable [1], for LuaFileSystem this time around [2], or "Look Ma, no hands" :o)

Usage example:

local File = require( 'File' )

-- get the current directory
local aDirectory = File()

-- recursively enumerate its content
for aFile in aDirectory( true ) do
    print( aFile )

-- get some attributes
print( aDirectory, aDirectory.mode, aDirectory.size )

-- list all attributes
for aKey, aValue in pairs( aDirectory ) do
    print( aKey, aValue )

Main differences from plain LuaFileSystem:

- It's a functable! 8^)
- Recursive directory enumeration
- Bridge to the standard io package (e.g. aFile.content and aFile.content = 'bla' )