Opens the system “Save as” dialog and returns the full path the user chose, or nil if they cancelled.
The returned path is a full machine path. savefiledialog only asks where to save; it does not write anything, and the path cannot be given to writefile, which takes workspace paths.

Parameters

table
A map of description to pattern, e.g. { ["Lua files"] = "*.lua" }. Omit it and the dialog offers All files (*.*).
string
The dialog’s window title.
string
A default extension, appended when the user types a name without one.

Returns

string | nil
The chosen full path, or nil on cancel.

Behavior

  • Nothing is written. You get a path; saving is up to you.
  • Overwriting is confirmed by Windows if the file already exists.
  • The folder must exist, though the file need not.

Example