Pop-Up

Here is an example of Aty Scripts - UI Kit's pop up system creation and usage.

Pop-Up Creation Guide

Creating a Pop-Up

To create a pop-up, use the following function:

aty.createPopUp("Vending", "Purchase a drink.", "Press 'Purchase' to purchase a drink", {
    name = "test_pop",
    accept = {
        text = "Purchase",
        color = "green",
        active = true
    },
    cancel = {
        text = "Cancel",
        color = "red",
        active = true
    }
})

Pop-Up Parameters

Title

  • "Vending" The title of the pop-up. Type: string

Subtitle

  • "Purchase a drink" The subtitle of the pop-up, providing additional context. Type: string

Description

  • "Press 'Purchase' to purchase a drink" Detailed instructions or information displayed within the pop-up. Type: string

Name

  • "test_pop" A unique identifier for the pop-up, used to trigger it programmatically. Type: string


Buttons Configuration

Accept Button

The button users press to confirm or accept the action.

  • text: The label of the button (e.g., "Purchase").

  • color: The button's color. Choose from:

    • "green"

    • "red"

    • "blue"

    • "black"

  • active: Determines if the button is visible (true) or hidden (false).

Cancel Button

The button users press to cancel the action.

  • text: The label of the cancel button (e.g., "Cancel").

  • color: The button's color (options are the same as the accept button).

  • active: Determines if the button is visible (true) or hidden (false).


Triggering and Handling the Pop-Up

To trigger and handle the pop-up, use the following function:

aty.openPopUp("test_pop", function(result)
    if result == "ok" then
        -- Code to handle the accept action
    elseif result == "cancelled" then
        -- Code to handle the cancel action
    end
end)

Handling the Result

  • "ok": Indicates the accept button was clicked. Add logic to process this action.

  • "cancelled": Indicates the cancel button was clicked. Add logic to handle cancellation.


This structure allows you to easily create customizable and interactive pop-ups with clear parameters and consistent handling.

Last updated