These paths are not workspace paths. A dialog returns a full path anywhere
on the machine, while
readfile and the other
filesystem functions only accept workspace-relative paths. The two do not mix:
you cannot hand a dialog result to readfile.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.
Returns
table
An array with the chosen full path at index
1, or an empty table if the user
cancelled.Behavior
- The file must exist. The dialog will not accept a name that is not there.
- A table is always returned, so you can check
#result == 0for cancel rather than testing fornil. - It blocks while open. The dialog is modal, so the calling thread waits for the user.
Example
Related
openfilesdialog: pick several files.savefiledialog: pick a save location.openfolderdialog: pick a folder.