Module: alert

This module helps you creating popups.

alert = require("alert")
local done = alert:create("Done!")

alert

Functions

Creates an alert

alert:create("Done!")

alertInstance

An alertInstance can be used to personalize its buttons.

Functions

setNegativeCallback ( string text, function callback optional )

Creates, sets the text and callback of a negative button in the alertInstance.
Using nil for the callback will remove the button
Buttons are displayed in that order: NEUTRAL, NEGATIVE, POSITIVE.

local instance = alert:create("Are you sure?")
instance:setNegativeCallback("No", function()
-- add your code here
end)
instance:setNegativeCallback("No", nil) -- removes the button
setNeutralCallback ( string text, function callback optional )

Creates, sets the text and callback of a neutral button in the alertInstance.
Using nil for the callback will remove the button
Buttons are displayed in that order: NEUTRAL, NEGATIVE, POSITIVE.

local instance = alert:create("Are you sure?")
instance:setNeutralCallback("Cancel", function()
-- add your code here
end)
setPositiveCallback ( string text, function callback optional )

Sets the text and the callback for positive button. Using nil for the callback removes the button.

local instance = alert:create("Are you sure?")
instance:setPositiveCallback("Yes!", function()
-- add your code here
end)
📃 Source