Filesystem

isfolder

Checks whether a workspace path exists and points to a folder.

Syntax

isfolder(path: string): boolean

Arguments

NameTypeDescription
pathstringWorkspace-relative path to the file or folder.

Returns

NameTypeDescription
isFolderbooleanTrue when the path exists and is a folder.

Description

Checks whether a workspace path exists and points to a folder.

Call it with 1 parameter(s): path. The argument table explains which values are required and which ones only refine the behavior.

It returns isFolder (boolean). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Check whether a workspace path points to a directory.

local path = "workspace/examples"

if isfolder(path) then
    print("Folder exists")
else
    makefolder(path)
end