---
title: "openfiledialog"
description: "Shows a Windows file chooser and returns the selected absolute path."
---

```lua
openfiledialog(filter: string?, title: string? = "Open File"): string?
```

---

## Aliases

None.

---

## Arguments

<ParamField body="filter" type="string">
  A NUL-separated Win32 filter string containing label/pattern pairs.
</ParamField>

<ParamField body="title" type="string" default={"\"Open File\""}>
  The native dialog title.
</ParamField>

---

## Returns

<ResponseField name="path" type="string?">
  The selected absolute file path, or nil on cancel/native failure.
</ResponseField>

Returns nil on cancel or native failure. Filters use NUL-separated Win32 label/pattern pairs. Dialogs block while open; their paths do not bypass workspace restrictions.

---

## Example

```lua
local path = openfiledialog("Text files *.txt All files *.*  ", "Choose a file")
print(path or "Cancelled")
```
