messagebox Asynchronous
messageboxasync
Open a system message dialog and wait for its button result. Use it for a decision that should be explicit before the script continues.
Luau
messagebox(text: string, caption: string, flags: number) -> numberParameters
| Parameter | Type | Description |
|---|---|---|
text | string | Body text shown in the dialog. |
caption | string | Dialog title. |
flags | number | 32-bit Windows-style message-box bitmask interpreted by the Android dialog. |
Returns
numberA numeric button code, or 0 when the dialog cannot complete.
Usage notes
The low nibble chooses buttons: 0 is OK, 1 is OK/Cancel, 3 is Yes/No/Cancel, and 4 is Yes/No. Yes returns 6, No returns 7, and Cancel returns 2.
Icon bits 0x10, 0x20, and 0x40 request alert, help, and info icons. The call can yield while the user decides.
Example
Luau
local result = messagebox("Replace the saved settings?", "Confirm save", 4)
if result == 6 then -- Yes
print("The user chose to replace them")
elseif result == 7 then -- No
print("The user kept the existing settings")
end