lua-users home
lua-l archive

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


Depending on your situation, simply knowing whether or not
the "name"  exists in the file system might not tell you the
whole story.

On Linux the io.open(name, "r") will fail even on an existing
file if you don't have read permissions, and will succeed if
you do, even when the "name" is actually a directory. (Which
might not be what you expect.)

If you really want to know if it's a regular file and not some
other type of filesystem object, you might want to test for
something like:  ( lfs.attributes(name, "mode") == "file" )


 - Jeff