Skip to content

Globan onAction Methods

Sh1zok edited this page Oct 18, 2025 · 1 revision

As with a simple action, you can assign methods that will be executed every time you perform the corresponding actions(left/right click or scroll) with the list.


setOnLeftClick() Aliases: onLeftClick()

Sets a method that will be executed every time the list is clicked with the left mouse button.

setOnLeftClick()

Parameters:

Name Type Is required Description Default
method function Required The method that will be executed nil

Returns:

Type Description
table Returns self for chaining

Example:

myActionList:setOnLeftClick(function()
    sounds:playSound("block.wool.break", player:getPos()) -- Sound on left click
end)

setOnRightClick() Aliases: onRightClick()

Sets a method that will be executed every time the list is clicked with the right mouse button.

setOnRightClick()

Parameters:

Name Type Is required Description Default
method function Required The method that will be executed nil

Returns:

Type Description
table Returns self for chaining

Example:

myActionList:setOnRightClick(function()
    sounds:playSound("block.wool.break", player:getPos()) -- Sound on right click
end)

setOnScroll() Aliases: onScroll()

Sets a method that will be executed every time the list is scrolled.

setOnScroll()

Parameters:

Name Type Is required Description Default
method function Required The method that will be executed nil

Returns:

Type Description
table Returns self for chaining

Example:

myActionList:setOnScroll(function()
    sounds:playSound("block.lever.click", player:getPos(), 1, 2, false) -- A little click sound on scroll
end)
Clone this wiki locally