-- values for the elements
local sliderValue = {
selected = 1.0,
min = 1.0,
max = 100.0,
step = 5.0
}
local comboValue = {
selected = 1,
values = { "test_value", "second_value" },
words = { "Hello World", "Select me" }
}
local colorValue = {
r = 255, g = 255, b = 255, a = 255,
rainbow = false
}
local checkValue = {
bool = false
}
-- the current value is only available if a slider, combo or check is clicked
-- otherwise it will be `nil`
function exampleOnClick(currentValue)
print("Element clicked", currentValue)
end
-- table of elements that will be returned
return {
{
type = "button",
text = "First Button",
onClick = exampleOnClick
},
{
type = "separator",
text = "Other Stuff"
},
{
type = "check",
text = "Check me",
value = checkValue,
},
{
type = "slider",
text = "Select a range",
value = sliderValue,
onClick = exampleOnClick
},
{
type = "combo",
text = "Select a type",
value = comboValue,
onClick = exampleOnClick
},
{
type = "color",
text = "Pick a color",
value = colorValue
},
{
type = "menubutton",
text = "Open Test Submenu",
value = "TestSubmenu"
},
{
type = "submenu",
text = "Test Submenu",
value = "TestSubmenu",
parent = nil, -- if `parent = nil` then the custom luas submenu will be used as parent
elements = {
{
type = "button",
text = "Second Button",
onClick = exampleOnClick
},
{
type = "menubutton",
text = "Next Submenu",
value = "SecondSubMenu"
}
}
},
{
type = "submenu",
text = "Test Submenu",
value = "SecondSubMenu",
parent = "TestSubmenu",
elements = {
{
type = "button",
text = "Third Button",
onClick = exampleOnClick
}
}
}
}