Its super annoying when lets say I only want to adjust the offset position of a GUI to be based on its AbsoluteSize that I have to reconstruct the entire Position UDim2 when I’m only changing one value and it creates a long line of code to write it out to ensure the other values are preserved.
I should just able to do
GUI.Position.X.Offset = -GUI.AbsoluteSize.X/2
and safely assume all of the other values are preserved.
Instead of doing
GUI.Position = UDim2.new(GUI.Position.X.Scale,-GUI.AbsoluteSize.X/2,GUI.Position.Y.Scale,GUI.Position.Y.Offset)
Yeah this limitation is pretty painful (for all the types).
If this isnt possible, a method could be added (preferably all of the following, but it would be a lot of methods, not that it really matters):
udim:set(xs,xo,ys,yo) --doesnt save much writing so maybe not this one
udim:setScale(x,y) --or vector2
udim:setOffset(x,y) --or vector2
Additionally, arithmetic operations should be defined for all coordinate types (I dont think Color3 has those for example?).
TBH they shouldve just derived color3 from vector3 and UDim2 from a vector4 (if they really need to be their own types…)
I think your life would be much more painful if these types were mutable. They’re by-reference in Lua, so if you passed one to a function and it did any modification to it, it’d actually change yours. I’m not sure this is the behavior anyone really wants, so they’re immutable types.