What does "%.1f" mean? learning about strings

so ive been reading up about strings but im not sure what “%.1f” means. i appreciate any help!

here is the line i was reading:

			print(string.format("%s is close (%.1f studs away)", otherPlr.Name, dist))

original post:

It just means to format the number as a floating number with 1 decimal place value. You can change that number to whatever will work for you as well:

print(string.format("The number: %.3f", 1.5352362631666))
-- > 1.535

Keep in mind that the result will be a string!

3 Likes

wow that makes a lot more sense now, thanks a million locard

1 Like

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