Miliastra Wonderland Lua API

ClientUIPresetButtonControl

The type that represents an instance of a Preset Button component. Contains functions for managing cursor event listeners.

Methods5

function ClientUIPresetButtonControl:AddCursorEventListener(eventType: EnumItem.CursorEventType, callback: fun(eventData: CursorEventData) -> nil)

Registers a cursor event listener to the Client Control.

See:

Parameters
eventTypeEnumItem.CursorEventType

The cursor event type to listen for.

callbackfun(eventData: CursorEventData) -> nil

The callback function, which exposes data about the cursor event.

function ClientUIPresetButtonControl:RemoveCursorEventListener(eventType: EnumItem.CursorEventType, callback: fun(eventData: CursorEventData) -> nil)

Removes the specified cursor event listener from the Client Control.

See:

Parameters
eventTypeEnumItem.CursorEventType

The event type to remove the callback from.

callbackfun(eventData: CursorEventData) -> nil

The callback function to remove.

function ClientUIPresetButtonControl:RemoveCursorEventListeners(eventType: EnumItem.CursorEventType)

Removes all cursor event listeners for the specified event type from the Client Control.

See:

Parameters
eventTypeEnumItem.CursorEventType

The event type to clear listeners from.

function ClientUIPresetButtonControl:RemoveAllCursorEventListeners()

Removes all cursor event listeners from the Client Control.

function ClientUIPresetButtonControl:SimulateCursorClick()

Simulates the CursorDown, CursorUp, and CursorClick events in sequence.

Fields3

ClientUIPresetButtonControl.interactable : boolean

[Read/Write] Whether the Preset Button responds to user input and triggers events.

ClientUIPresetButtonControl.clickAudioId : integer

[Read/Write] The ID of the sound effect to play when the button is clicked.

ClientUIPresetButtonControl.raycastTarget : boolean

[Read/Write] Whether the Preset Button can receive cursor interaction events.