juju scripting documentation
  • Scripting Documentation
  • Creating a script
    • Necessities
      • Example Script
      • Example Script 2
      • Example Script 3
  • Documentation
    • Elements
      • Element Properties
      • Element API
    • Utility Functions
  • Da Hood
    • Signals
    • Functions
Powered by GitBook
On this page
  • Toggle
  • Slider
  • Dropdown
  • Colorpicker
  • Textbox
  • Button
  1. Documentation
  2. Elements

Element API

Each signal is fired when a new value is set to an element, some may not if the second argument to the setting function is true.

element:create_settings()
Returns
Type
Description

section (copy)

Table

This creates a fake section openable by the cog icon next to your element label. This fake section's create_element function has identical functionality to juju.create_element, just without the section name arg.

element:set_visible(visible: Boolean)
Returns
Description

None

N/A

Toggle

Signal
Description

on_toggle_change

This signal is fired the first argument being the new value of the toggle

Function
Return Type
Description

set_toggle

None

Sets the toggle state to the first argument

local void_hide = juju["find_element"]("hvh", "void hide")

local connection = juju["create_connection"](void_hide["on_toggle_change"], function(bool)
    print(bool) -- will print true after it is set below, unless void hide-
    -- is already on in which case this signal will not fire
end)

void_hide:set_toggle(true)

Slider

Signal
Description

on_slider_change

This signal is fired the first argument being the new value of the slider

Function
Return Type
Description

set_slider

Number

Sets the slider value to the first argument

Dropdown

Signal
Description

on_dropdown_change

This signal is fired the first argument being the new value of the dropdown

Function
Return Type
Description

set_dropdown

None

Sets the selected dropdown options to the first argument

set_options

None

Sets the dropdown's available options to the first argument

Colorpicker

Signal
Description

on_transparency_change

This signal is fired with the first argument being the new transparency of the colorpicker

on_color_change

This signal is fired with the first argument being the new color of the colorpicker

Function
Return Type
Description

set_colorpicker_transparency

None

Sets the colorpicker transparency to the first argument

set_colorpicker

None

Sets the colorpicker color to the first argument

Textbox

Signal
Description

on_textbox_change

This signal is fired with the first argument being the new value of the textbox

Function
Return Type
Description

set_textbox

None

Sets the textbox value to the first argument

Button

Signal
Description

on_clicked

This signal is fired when the button is clicked in the menu

PreviousElement PropertiesNextUtility Functions

Last updated 24 days ago