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.
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.
| Parameter | Type | Description |
|---|---|---|
recursive | boolean? | 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
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