SOTR654
(SOTR654)
August 9, 2026, 6:30am
1
Small change, hopefully, but useful for scaling: it would be amazing if it could do the calculation directly.
local range = NumberRange.new(1, 2)
print(range*5)
Currently it’s giving an error: attempt to perform arithmetic (mul) on NumberRange and number
But it would be incredible if it works:
local range = NumberRange.new(1, 2)
local newRange = range*5 -- NumberRange.new(5, 10)
print(newRange) -- Output: 5 10
local divRange = newRange/2 -- NumberRange.new(2.5, 5)
print(divRange) -- Output: 2.5 5
Why? To simplify scaling issues; if I have a range where I want to maintain the proportion, I can apply a scalar.
Yea, I can do it with code:
local range = NumberRange.new(1, 2)
local scale_1 = 5
local newRange = NumberRange.new(range.Min*scale_1, range.Max*scale_1)
print(newRange) -- Output: 5 10
local scale_2 = 1/2
local divRange = NumberRange.new(newRange.Min*scale_2, newRange.Max*scale_2)
print(divRange) -- Output: 2.5 5
But it’s faster and easier to read with direct multiplication
5 Likes
it cant be so hard to do
local by = 5
local mult = NumberRange.new(range.Mix*by,range.Max*by)
Who said it’s hard ? It isn’t hard to overload opeartors too
1 Like
NumberRange to get an operator would have a lot of runtime tax that is unnesesary
its a userdata and not a luau data type
SOTR654
(SOTR654)
August 10, 2026, 2:38am
5
I literally mention it?
SOTR654:
Why? To simplify scaling issues; if I have a range where I want to maintain the proportion, I can apply a scalar.
Yea, I can do it with code:
local range = NumberRange.new(1, 2)
local scale_1 = 5
local newRange = NumberRange.new(range.Min*scale_1, range.Max*scale_1)
print(newRange) -- Output: 5 10
local scale_2 = 1/2
local divRange = NumberRange.new(newRange.Min*scale_2, newRange.Max*scale_2)
print(divRange) -- Output: 2.5 5
But it’s faster and easier to read with direct multiplication
Simply to make it cleaner, another option is to create a module that mimics this and use metatables.
1 Like
SOTR654:
metatables
Don’t inject runtime tax bloat please.
We need less of it, not more.
I still struggle to understand need for such thing in the first place
notfenv
(notfenv)
August 10, 2026, 8:01am
7
I’d like to mention that most Feature Requests (especially for Luau) are written with the intent of making things more convenient all around. Your reasoning for this is just very hypocritical and if this were the case, you could apply this same methodology to Vectors, CFrames, etc.
Have fun multiplying the components of a vector one by one, by your logic. Also, NumberRange is a data type.
Your excuse of ‘runtime tax’ also has no merit at all; your exact principle can be applied to every other data type like I just mentioned
Just be respectful please.
4 Likes
SOTR654
(SOTR654)
August 10, 2026, 2:43pm
8
Use it if you want to or not lol, nobody’s forcing you
Time to go back to tutorials?
A pretty good feature, and as mentioned above:
most Feature Requests (especially for Luau) are written with the intent of making things more convenient all around. Your reasoning for this is just very hypocritical and if this were the case, you could apply this same methodology to Vectors, CFrames, etc
1 Like