Document:List Synchronous

Get the children of a selected folder as document handles. Use it to build a folder browser or collect documents for an import. Each result is another Document, so inspect its type before reading it or listing its 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?Whether to include descendants inside subfolders. Omitted or nil means false.

Returns

{Document}

An array of Document handles. Listing a file raises an error.

Usage notes

Document is a handle returned by a file dialog or a folder method. Call its methods with a colon, for example document:Read(). After Delete succeeds, that handle is invalid and further method calls raise an error.

Example

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