I’ve been wanting to switch my approach from using comboboxes to sliders in my script, making it way better scalable.
But after placing them in the UI and binding them to some variables, I’ve noticed that on reload (after changing the value), it snaps to the maximum value.
To sum up my problem, it goes something like this:
(This is a full test script)
-- SLIDER TEST
local dlg = Dialog
{
title = "SliderTest"
}
local sliderVar = 15
dlg:slider
{
id=Slider,
min=3,
max=32,
value=sliderVar,
onrelease=function()
sliderVar = dlg.data.Slider
end
}
:button
{
id = "Print",
text = "Print",
onclick = function()
print (sliderVar)
end
}
:show
{
wait = false
}
}
If I print out the variable before change, it’s 15, as expected.
But if I either use no variable at all, or use the slider(slide it to a different value), it will only output “nil”.
I’m currently not sure if I’m using the slider wrong, am messing up or this is an actual bug. Can someone else verify?