{{newin|[[0.9.2]]|092|type=function}}
Displays a message box dialog above the love window. The message box contains a title, optional text, and buttons.
{{notice|This function will pause all execution of the main thread until the user has clicked a button to exit the message box. Calling the function from a different thread may cause love to crash.}}
== Function ==
Displays a simple message box with a single 'OK' button.
=== Synopsis ===
<source lang="lua">
success = love.window.showMessageBox( title, message, type, attachtowindow )
</source>
=== Arguments ===
{{param|string|title|The title of the message box.}}
{{param|string|message|The text inside the message box.}}
{{param|MessageBoxType|type ("info")|The type of the message box.}}
{{param|boolean|attachtowindow (true)|Whether the message box should be attached to the love window or free-floating.}}
=== Returns ===
{{param|boolean|success|Whether the message box was successfully displayed.}}

== Function ==
Displays a message box with a customized list of buttons.
=== Synopsis ===
<source lang="lua">
pressedbutton = love.window.showMessageBox( title, message, buttonlist, type, attachtowindow )
</source>
=== Arguments ===
{{param|string|title|The title of the message box.}}
{{param|string|message|The text inside the message box.}}
{{param|table|buttonlist|A table containing a list of button names to show. The table can also contain the fields <code>enterbutton</code> and <code>escapebutton</code>, which should be the index of the default button to use when the user presses 'enter' or 'escape', respectively.}}
{{param|MessageBoxType|type ("info")|The type of the message box.}}
{{param|boolean|attachtowindow (true)|Whether the message box should be attached to the love window or free-floating.}}
=== Returns ===
{{param|number|pressedbutton|The index of the button pressed by the user. May be 0 if the message box dialog was closed without pressing a button.}}

== Examples ==
=== Display a simple message box if the user's system doesn't support shaders ===
<source lang="lua">
local errortitle = "Shader support is required for the game to run"
local errormessage = "This system is below the minimum system requirements for the game.\
If your graphics drivers aren't up-to-date, try updating them and running the game again."

if not love.graphics.isSupported("shader") then
    love.window.showMessageBox(errortitle, errormessage, "error")
end
</source>

=== Display a message box with customized buttons ===
<source lang="lua">
local title = "This is a title"
local message = "This is some text"
local buttons = {"OK", "No!", "Help", escapebutton = 2}

local pressedbutton = love.window.showMessageBox(title, message, buttons)
if pressedbutton == 1 then
    -- "OK" was pressed
elseif pressedbutton == 2 then
    -- etc.
end
</source>

== See Also ==
* [[parent::love.window]]
[[Category:Functions]]
{{#set:Description=Displays a message box above the love window.}}
== Other Languages ==
{{i18n|love.window.showMessageBox}}