Volt

messagebox

Displays a message box dialog.

Syntax

messagebox(text: string, caption: string, flags: number) -> number

Parameters

ParameterTypeDescription
textstringThe message text
captionstringThe window title
flagsnumberButton and icon flags

Returns

TypeDescription
numberThe button pressed by the user

Description

messagebox displays a Windows-style message box with customizable buttons and icons.

Common Flags

FlagDescription
0OK button
1OK + Cancel
4Yes + No
16Error icon
32Question icon
48Warning icon
64Info icon

Return Values

ValueDescription
1OK
2Cancel
6Yes
7No

Example

-- Simple message
messagebox("Hello!", "Greeting", 0)

-- Confirmation dialog
local result = messagebox("Are you sure?", "Confirm", 4 + 32)
if result == 6 then
    print("User clicked Yes")
else
    print("User clicked No")
end

-- Warning message
messagebox("Something went wrong!", "Warning", 0 + 48)

Notes

  • Flags can be combined with addition
  • This is a yielding function

On this page