Skip to content
Saiko

savefiledialog

Opens a dialog for the user to choose where to save, writes the content to the path they chose, and returns the file. Only the calling thread waits until the dialog is dismissed.

Signature

luau
savefiledialog(content: string, options: saveDialogOptions?): file?

Parameters

contentstring

What to write to the file.

optionssaveDialogOptions?

Optional: the window title, the folder it opens in, the file types, a suggested name and a default extension.

Returns

file?

Note

Example

luau
print("Save your config")

local config = "{ aimbot = true }"
local configFile = savefiledialog(config, {
    extensionFilter = { "json" },
    suggestedName = "config",
    defaultExtension = "json",
})

if configFile then
    print("Save success")
else
    print("Save cancelled")
end