Creating Element Objects

Prerequisites

Elements are all created via one function, newElement, meaning you can combine toggles, colorpickers, etc all into one element. This function are apart of sections, which are currently not creatable. Rather, you are given two full size sections in the Lua tab.

Flags are NOT set to nil after an element object is destroyed via Destroy.

Create An Element

<table Element Object> newElement(<table> Element Information)

Example

local section = juju.section
local flags = juju.flags

local toggle_with_colorpicker = section:newElement({
    name = "Example",
    types = {
        toggle = {
            flag = "example", 
            default = false
        },
        colorpicker = {
            default = Color3.fromRGB(255,0,0),
            default_transparency = 0,
            flag = "example_color",
            transparency_flag = "example_transparency"
        },
        dropdown = {
            default = {"5","6"}
            multi = true,
            options = {"1","2","3","4","5","6","7"},
            no_none = false,
            flag = "example_dropdown"
        }
    }
})

print(flags["example"]) -- false
toggle_with_colorpicker:setToggle(true)
print(flags["example"]) -- true

print(flags["example_color"]) -- 255,0,0
print(flags["example_transparency"]) -- 0
toggle_with_colorpicker:setColor(Color3.fromRGB(0,0,0), 1)
print(flags["example_color"]) -- 0,0,0
print(flags["example_transparency"]) -- 1

print(flags["example_dropdown"]) -- table; {"5" ,"6"}
toggle_with_colorpicker:setSelected({"1","2","3"})
print(flags["example_dropdown"]) -- table; {"1" ,"2", "3}

Last updated