Created
February 14, 2012 05:29
-
-
Save perusio/1823888 to your computer and use it in GitHub Desktop.
Test if a file exists using Lua posix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Test if a file exists using Lua posix https://github.com/rrthomas/luaposix. | |
local posix = require('posix') | |
-- Test if a file exists. | |
-- @param fname string | |
-- filename | |
-- @return boolean | |
-- true if file exists, false otherwise | |
-- | |
function file_exists(fname) | |
return posix.stat(fname).type == 'regular' | |
end -- file_exists |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment