Skip to content

isfile

isfile checks whether a given path exists and refers to a file.

This function is useful when validating input, confirming file existence before reading, or filtering entries returned by listfiles.

function isfile(path: string): boolean

Parameters

Parameter Description
path The path to check.

Example

Checking file existence
1
2
3
print(isfile("nonexistent.txt")) -- Output: false
writefile("file3.txt", "")
print(isfile("file3.txt")) -- Output: true