Available since LÖVE 0.9.2
This function is not supported in earlier versions.
Displays a message box dialog above the love window. The message box contains a title, optional text, and buttons.
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.
Displays a simple message box with a single 'OK' button.
success = love.window.showMessageBox( title, message, type, attachtowindow )
string titlestring messageMessageBoxType type ("info")boolean attachtowindow (true)boolean successDisplays a message box with a customized list of buttons.
pressedbutton = love.window.showMessageBox( title, message, buttonlist, type, attachtowindow )
string titlestring messagetable buttonlistenterbutton and escapebutton, which should be the index of the default button to use when the user presses 'enter' or 'escape', respectively.MessageBoxType type ("info")boolean attachtowindow (true)number pressedbuttonlocal 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 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
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.window.showMessageBox