Behavior change: tostring() will start returning shortest precise decimal representation of numbers

yeah but still. why do i have to do extra code? why couldn’t they just have made it with an extra argument?

It’s not extra code. Just a change in function call. Additionally, all this really messes up is displaying these numbers to players, but doesn’t actually break the code itself.

Even if Roblox did add an additional argument to tostring (I don’t know of any instances of Roblox changing arguments to Lua standard functions, so they probably wouldn’t anyway), wouldn’t you be contradicting yourself by complaining about having to write “extra code”, yet proposing an additional argument (which would be extra code)?

2 Likes

like true or false. but still. it’s annoying concatenating a number to a string only for it to have a million decimals. its an inconvenience. i dont want to write new code just to make it work how I want it to.

You would still have to edit your code anyway to revert to the old behavior, so you might as well use the recommended string.format("%.1f", v) while you’re at it. Don’t be difficult.

It ruins things like concatenating. Tostring is meant to convert to string. This will ruin tons of things. Like concatenation and many other things. Beginner scripters wont know to do string.format.

If you’re using a string-format anyways then you don’t need concatenation:

local str = "Part one " .. number .. " part two"
-->
local str = string.format("Part one %.1f part two", number)

The second option is better in the long run too because it can correctly handle localization vs concatenation cannot.

5 Likes

Oh ok thx for telling me didn’t know i could do it

I don’t think @Qualadore was talking about the tweet they linked.

1 Like

it actually do make sense i think it actually make sense it is just diffrent opinion for diffrent people

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.