I recently upgraded from Lua 5.2.3 to 5.3.1 but I noticed all my scripts that perform a string.format started failing if it tried to format a float using %d
local anExampleString = string.format("Sample Number: %d",10.100000001) -- Fails on 5.3.1, works on 5.2.3
local aWorkingString = string.format("Sample Number: %.0f",10.100000001) -- Works on 5.3.1
Is this by design? I can't seem to find the change documented anywhere.
In Lua 5.3, the number type has two subtypes, integer and float.
From string.format
Options
A,a,E,e,f,G, andgall expect a number as argument. Optionsc,d,i,o,u,X, andxexpect an integer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With