listfiles Synchronous

List the immediate children of a workspace directory. The returned paths can be handed directly to isfile, readfile, or the other workspace functions.

Syntax
Luau
listfiles(path: string) -> {string}

Parameters

Function parameters
ParameterTypeDescription
pathstringWorkspace-relative directory to list.

Returns

{string}

An array of workspace-relative child paths.

Usage notes

This is one directory level. To descend further, call listfiles on returned paths for which isfolder is true.

Differences from Volt

Volt documents access through explicitly created workspace symlinks. Kawaii rejects symlinks in workspace paths; all workspace operations remain subject to its path containment checks.

Example

Example
Luau
makefolder("example-settings")
for _, path in ipairs(listfiles("example-settings")) do
    print(isfolder(path) and "folder" or "file", path)
end
Kawaii documentation