Syntax
isfolder(path: string): booleanArguments
| Name | Type | Description |
|---|---|---|
path | string | Path resolved inside the workspace after separator normalization and workspace-boundary checks. Invalid or outside-workspace paths error before a boolean is returned. |
Returns
| Name | Type | Description |
|---|---|---|
isFolder | boolean | True only when the resolved path exists and is a directory; files and missing paths return false. |
Description
Returns whether a path resolved inside the workspace exists and is a directory.
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 resolves to an existing directory.
local folderPath = "examples"
local filePath = "examples/config.json"
makefolder(folderPath)
writefile(filePath, "{}")
print(isfolder(folderPath))
print(isfolder(filePath))
print(isfolder("examples/missing"))