openfolderdialog Asynchronous
Ask the user for a folder, then browse or add children through the returned handle. Use it when the import or export location should be their choice.
Luau
openfolderdialog(options: FileDialogOptions?) -> Document?Parameters
| Parameter | Type | Description |
|---|---|---|
options | FileDialogOptions? | Optional FileDialogOptions table; use its named fields to guide the system picker. |
Argument fields
Luau
FileDialogOptions = {
defaultPath: string?, title: string?, extensionFilter: {string}?,
suggestedName: string?, defaultExtension: string?
}| Field | Description |
|---|---|
defaultPath | Initial picker location. The Android picker uses this only when it is a content:// URI. |
title | Optional chooser title for open dialogs. It is not used as the save filename. |
extensionFilter | Array of extensions, such as {"txt", "json"}. Known extensions are converted to MIME filters; unknown-only filters allow all types. Folder dialogs do not use this filter. |
suggestedName | Suggested filename for savefiledialog. Defaults to untitled when omitted or empty. |
defaultExtension | Extension appended to the suggested save filename when it does not already have that extension. Leading dots are removed. |
Returns
Document?A folder Document, or nil if the picker is cancelled.
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.
Folder handles support List and MakeFolder; Read and Write require a file.
Example
Luau
local folder = openfolderdialog({ title = "Choose an export folder" })
if folder then
print("Selected folder:", folder:GetName())
for _, child in ipairs(folder:List(false)) do
print("Found:", child:GetName())
end
end