lia.bar

Helper library for generating bars.

Functions

add(getValue, color, priority, identifier)

Adds a new bar or updates an existing one.

Parameters

  • getValue Function

    The function to retrieve the current value of the bar.

  • color Color optional

    The color of the bar.

  • priority Integer optional

    The priority of the bar in the draw order.

  • identifier String optional

    The identifier of the bar.

Returns

  • any

    int The priority of the added or updated bar.

draw(x, y, w, h, value, color)

Draws a single bar with the specified parameters.

Parameters

  • x Integer

    The x-coordinate of the top-left corner of the bar.

  • y Integer

    The y-coordinate of the top-left corner of the bar.

  • w Integer

    The width of the bar.

  • h Integer

    The height of the bar.

  • value Integer

    The current value of the bar (0 to 1).

  • color Table

    The color of the bar.

drawAction()

Internal

This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.

Draws the action bar, if applicable.

drawAll()

Internal

This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.

Draws all bars in the list.

get(identifier)

Retrieves information about a bar identified by its identifier.

Parameters

  • identifier String

    The identifier of the bar.

Returns

  • any

    table The information about the bar if found, nil otherwise.

remove(identifier)

Removes a bar identified by its identifier.

Parameters

  • identifier String

    The identifier of the bar to remove.