Skip to main content

Arguments

string
required
Lua string bytes to write to the selected file. The file is opened in binary truncate mode after the user confirms a path.
DialogOptions
Optional table. savefiledialog uses title, defaultPath, extensionFilter, suggestedName, and defaultExtension. extensionFilter is a table of extension strings; leading . or *. is stripped before each filter becomes *.<extension>. defaultExtension strips leading . characters before it is passed to SetDefaultExtension.

Returns

FileSystemItem | nil
Saved file item, or nil when the dialog is cancelled. Dialog or write failures throw Failed to save file.

Types

DialogOptions

Configures the Windows file or folder selection dialog.

Example

Write generated content to a path chosen by the user and handle the saved file item.