Skip to content

openfiledialog

Opens a dialog to select a file. Blocks the calling thread until the dialog is dismissed.

Signature

declare function openfiledialog(options: fileDialogOptions?): file?

Extensions

Summary

Parameters

Parameter Type Description
options fileDialogOptions? Optional options for the file dialog.

Returns

Type Description
file? File object, or nil if the user cancelled.

Examples

Config system

print("Pick a config to use")

local config
local configFile = openfiledialog({
    extensionFilter = { "json" },
})

if configFile then
    config = configFile:Read()
else
    print("No config selected.")
end