Luart
Comprehensive Windows framework to develop in Lua
modules > ui > dirdialog

ui.dirdialog ([prompt])

Displays a dialog box for the user to choose an existing directory.

Parameters

prompt

An optional string that gives the user indication for the selection.

Return value

The function returns the selected folder as a Directory object or nil if the user selected none.

Example


local ui = require "ui"

-- open a dialog to choose an existing folder
local dir = ui.dirdialog("Please select a folder to count its entries : ")

-- checks if a folder has been selected
if dir ~= nil then
	-- Outputs the number of the directory entries
	ui.info("The choosen folder contains "..#dir.." entries")
end