ReferenceMiscellaneous

MessageBox.new

Creates an Apex dialog with your own buttons.

Syntax

MessageBox.new(options: {Title: string?, Text: string, Buttons: {string}?, Duration: number?, Icon: string | number?, Yield: boolean?, Callback: function?}) -> MessageBox

Parameters

ParameterTypeDescription
optionstableText is required. Buttons holds 1 to 3 names and defaults to {"OK"}. Duration closes the box after that many seconds. Icon is a MessageBox.Icons name or number. Yield defaults to true. Callback receives the choice.

Returns

TypeDescription
MessageBoxA box that is shown with :Show().

Description

:Show() opens the dialog. With Yield true it waits and returns the choice, which is the button's text, "TimedOut" when Duration ran out, or "ForceClosed" after :Close(). With Yield false it returns at once and the choice goes to Callback and to functions given to :OnChoice(). :Close() closes a showing box and returns whether it was still open. MessageBox.Icons has Error, Question, Warning and Information. Only one Apex dialog can be pending at a time.

Example

local box = MessageBox.new({Text = "Continue?", Buttons = {"Yes", "No"}, Duration = 10})
print(box:Show())

These are Game executor contracts. Check build requirements and session lifetimes before using them.