Sliders outputting nil values? v1.3-beta14-x64

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?

Is it a typo in the example that your slider’s id isn’t a string but a variable name? It should be in quotation marks.

1 Like

Oh, whoops, that’s a typo… Aaaaand… it fixed my problem…

I’m really sorry I keep coming here due to such trivial mistakes.

No problem, this forum is the place to get help. :v:

2 Likes