Syntax
isfile(path: string): booleanArguments
| Name | Type | Description |
|---|---|---|
path | string | Workspace-relative path to the file or folder. |
Returns
| Name | Type | Description |
|---|---|---|
isFile | boolean | True when the path exists and is a file. |
Description
Checks whether a workspace path exists and points to a file.
Call it with 1 parameter(s): path. The argument table explains which values are required and which ones only refine the behavior.
It returns isFile (boolean). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Check whether a workspace path points to a regular file.
local path = "workspace/examples/config.json"
if isfile(path) then
print("File exists")
else
print("File does not exist")
end