---
title: "messagebox"
description: "Shows a native Windows message box and returns its result code."
---

```lua
messagebox(text: string, caption: string, flags: number? = 0): number
```

---

## Aliases

None.

---

## Arguments

<ParamField body="text" type="string" required>
  The text to display or copy.
</ParamField>

<ParamField body="caption" type="string" required>
  The message-box title.
</ParamField>

<ParamField body="flags" type="number" default={"0"}>
  Numeric Windows message-box flags.
</ParamField>

---

## Returns

<ResponseField name="result" type="number">
  The numeric Win32 dialog result, such as 1 for OK.
</ResponseField>

Blocking native dialog. flags/result are Win32 MB_*/ID* numeric constants; 0 shows an OK button and OK returns 1.

---

## Example

```lua
local result = messagebox("Hello from Byte", "Docs example", 0)
print(result)
```
