Document:GetName Synchronous

Get the display name associated with a selected file or folder. Use the name in an import list, progress message, or export confirmation. Keep the Document handle for file operations; its display name alone does not identify a workspace file.

Syntax
Luau
Document:GetName() -> string

Parameters

Call this method with a Document receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.

This function takes no arguments.

Returns

string

The document name as a string. This is a name, not a workspace path.

Usage notes

Document is a handle returned by a file dialog or a folder method. Call its methods with a colon, for example document:Read(). After Delete succeeds, that handle is invalid and further method calls raise an error.

Example

Example
Luau
local document = openfiledialog()
if document then
    print("Selected:", document:GetName())
end
Kawaii documentation