Utilities

messagebox

Shows a Windows Windows message box by calling Windows message box with a yielding operation, then returns the integer result code produced by Windows message box.

Syntax

messagebox(text: string, caption: string, flags: number): integer

Arguments

NameTypeDescription
textstringMessage text passed directly to Windows message box.
captionstringCaption string passed directly to Windows message box.
flagsnumberNumeric flags value converted to an integer and passed directly to Windows message box.

Returns

NameTypeDescription
resultintegerInteger result code returned by the Windows Windows message box call.

Description

Shows a Windows Windows message box by calling Windows message box with a yielding operation, then returns the integer result code produced by Windows message box. It requires text and caption to be strings and flags to be a number. flags is converted to an integer and passed directly to Windows message box. Invalid argument types raise the type checking error from the function. No alias is registered.

Call it with 3 parameter(s): text, caption, flags. The argument table explains which values are required and which ones only refine the behavior.

It returns result (integer). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Show a Windows message box and read the integer result code returned by the dialog.

local result = messagebox("Real is ready.", "Real", 0)
print(result)