How do I force an editbox widget to numberic but allow negative?
I'm working on basic settings window for my hit combo popups addon, I'm trying to make a pair of editboxes where the user can set X and Y offsets from the center of the screen. Using the center is the most intuitive way to do it, so I'm trying to figure out how I can get it to allow negative numbers.
Using SetNumeric() or GetNumber() doesn't do it, the former won't let the user type in a negative value and with the latter it'll treat a negative value as non-numeric and just default it to zero.
Is there something else in the EditBox widget I'm not seeing that lets me do this, or is there maybe a different widget I should be using?
When the user enters a value, run it through local number = tonumber(input) which will accept negative numbers. If tonumber returns a number, accept the value and continue. If it returns nil, reset the EditBox to the last value, maybe even give an error.