Document:List Synchronous

Get Document handles for the contents of a selected folder. Choose recursive listing when you need descendants beyond its direct children.

Syntax
Luau
Document:List(recursive: boolean?) -> {Document}

Parameters

Call this method with a Document receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.

Function parameters
ParameterTypeDescription
recursiveboolean?Optional boolean; false or omitted lists only direct children.

Returns

{Document}

An array of child Documents.

Usage notes

A Document is a handle to the user-selected location, not a workspace path. Call methods with a colon and keep the handle for later operations.

Calling List on a file raises. Check each child's type before reading or listing it.

Example

Example
Luau
local folder = openfolderdialog()
if folder then
    for _, child in ipairs(folder:List(true)) do
        print(child:IsFolder() and "folder" or "file", child:GetName())
    end
end
Kawaii documentation