lua-users home
lua-l archive

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

Jerome Vuarand wrote:
If you have access to LuaFileSystem [1] you can also use:

function file_exist(file_name)
       return lfs.attributes(file_name, 'mode')~=nil

This may or may not be faster depending on your setup.

I use
  lfs.attributes(file_name, 'size') ~= nil

I wonder which one will be faster, assuming there is a difference? (just laziness on my part... I should measure them, but taking into account OS caching is not always trivial)
I guess it's an idle question anyway :-)