Re: How do I test for the existens of a file
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: How do I test for the existens of a file
- From: Enrico Colombini <erix@...>
- Date: 2008年10月24日 16:39:43 +0200
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
end
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 :-)
Enrico