How can I add zeros to decimals to display prices correctly

I want a UI to display a certain money value, this works fine when displaying £2.33 for example, although displays £2.30 as £2.3, is there a way I can detect when the value requires a zero on the end so I can add one?

1 Like

string.format().

local str = "2.3" 
print(string.format("£%.2f", str))
-- £2.30
2 Likes

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