Log In  

Hi! I was wondering if there is a way to format floats when printing them out like you would to with the good old printf("%2f", float{2}); in c++.

Thanks!

P#145633 2024-04-04 01:24

Yes, with string.format: print(string.format("%2f", 3.14159))

I think all the standard Lua string api is here.

P#145640 2024-04-04 03:28

Oh great, thanks @drankmaniso!

P#145665 2024-04-04 10:17

[Please log in to post a comment]