Filesystem

listfiles

Lists files and folders inside a workspace directory.

Syntax

listfiles(path: string): table

Arguments

NameTypeDescription
pathstringWorkspace-relative path to the file or folder.

Returns

NameTypeDescription
pathstableArray table of workspace paths found in the folder.

Description

Lists files and folders inside a workspace 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 paths (table). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Enumerate files inside a workspace directory.

for _, path in ipairs(listfiles("workspace/examples")) do
    print(path)
end