Skip to content

Creating the Action List itself

Sh1zok edited this page Oct 11, 2025 · 3 revisions

An Action List itself is a table made up of other tables.
Each second-order table is an "action" within which the following tags are written

Name Type Description
title string or table The title of the action, shown when the Action List is hovered over. May be a table for future JSON transformation
activeTitle string or table The title of the action when it selected, shown when the Action List is hovered over and this action is selected. May be a table for future JSON transformation
color Vector3 The color that will replace the default background color of the button when the action is selected
hoverColor Vector3 The color that will replace the default background hover color of the button when the action is selected
item string The item that will replace the default item of the button when the action is selected
hoverItem string The item that will replace the default hover item of the button when the action is selected
texture table The texture that will replace the default texture of the button when the action is selected
hoverTexture table The texture that will replace the default hover texture color of the button when the action is selected
onLeftClick function A function that will be executed when the action is selected and the user left-clicks on the button
onRightClick function A function that will be executed when the action is selected and the user right-clicks on the button
onSelect function A function that will be executed when the user selects this action by scrolling the list

Tip

The onSelect function has a scrollDirection parameter

Example

actionList = {
    [1] = {
        title = "Printer",
        onLeftClick = function()
            print("Hi! This is the first action!!")
        end
    },
    [2] = {
        title = "============", -- Divider
        onSelect = function(scrollDirection)
            if scrollDirection < 0 then -- Divider was selected from the third action
                myActionList:setSelectedActionIndex(myActionList:getSelectedActionIndex() - 1)
            else -- Divider was selected from the first action
                myActionList:setSelectedActionIndex(myActionList:getSelectedActionIndex() + 1)
            end
        end
    },
    [3] = {
        title = "Change the button color",
        onLeftClick = function()
            myActionList:setColor(vec(math.random(255) / 255, math.random(255) / 255, math.random(255) / 255))
        end
    }
}
Clone this wiki locally