Check if a file exists.
Requires: None
Code
-
-- Check if file exists function FileExists(strFileName) local fileHandle = io.open(strFileName,"r") if fileHandle ~= nil then io.close(fileHandle) return true else return false end end
Check if a file exists using Lua File System library.
Requires: lfs
Code
-
-- Check if file exists function FileExists(strFileName) if lfs.attributes(strFileName,"mode") == "file" then return true else return false end end
Last update: 16 Dec 2020