Document:Delete Synchronous

Delete the selected document and invalidate the handle used for this call. Use it to remove a document that your script no longer needs. Deletion changes the selected storage location, so do not treat it as merely closing the handle.

Syntax
Luau
Document:Delete() -> ()

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

()

This function returns no values.

Usage notes

Do not reuse this handle after successful deletion; even name and type queries reject a deleted handle.

Example

Example
Luau
-- This example creates a disposable file and then deletes that file.
local document = savefiledialog("Temporary", { suggestedName = "disposable-example.txt" })
if document then
    document:Delete()
    -- Do not call methods on this handle again.
end
Kawaii documentation