LuaV22 slider misrepresents its value

Started by truestone

truestone Lv 1

In below code, a slider initialized to a particular value shows a different value.

d = dialog.CreateDialog("test")
value = 1.7
repeat
print(value)
d.s = dialog.AddSlider("slider", value, 0, 5, 1)
dialog.Show(d)
value = d.s.value
until value == 0

The slider should be at 1.7 but shows 1.6. Slide it to 3.4 and close the dialog. The value printed is 3.4 but when fed back to the slider, it drops to 3.3.

tamirh Lv 1

Looks like it was just rounding down always instead of rounding to the closest value. I've fixed it, it should be out in the next devprev.

As a workaround before the fix goes out, just add a very small number to the value you are setting. So in your example, 1.7 would become 1.7001