With Luau nonstrict mode, I notice that I will get a warning ‘argument count mismatch’ for using the shorter-hand version of the functions, so even though UDim2.fromOffset
would typically require two arguments, X and Y, if I’m not in nonstrict mode I’m able to ditch Y if I don’t need it.
My question is, is it considered bad practice to avoid any optional arguments for cleanliness and to just use the default value, in this case 0? Or is this likely just unexpected behavior with Luau, especially since assert
with only one argument was wrongly warning before?
Examples:
local var1 = Vector3.new(X, Y) -- Z missing
local var2 = UDim2.new(XScale, XOffset) -- YScale, YOffset missing