ReferenceFilesystem

savefiledialog

Asks the user where to save the supplied bytes, then writes them to the chosen file.

Syntax

savefiledialog(content: string, options: table?) -> DialogItem?

Parameters

ParameterTypeDescription
contentstringBytes to save after destination selection.
optionstable?Dialog title, initial location and extension preferences.

Returns

TypeDescription
DialogItem?Selected item, or nil on cancellation.

Description

The options table accepts title, defaultPath, suggestedName, defaultExtension and extensionFilter. The extension filter is a list of extensions, for example {"txt", "json"}. The dialog yields while waiting for the user. Canceling returns nil and does not grant access to a path.

Returned items expose methods for the selected file or folder. They are not arbitrary filesystem paths. External changes to the selected object can invalidate an item.

Example

local item = savefiledialog("hello", { title = "Save example" })
if item then print(item:GetName()) end

These are Game executor contracts. Check build requirements and session lifetimes before using them.