Posted 12 December 2012 - 08:36 AM
ComputerCraft Version Information: 1.46 Client (& 1.46 Server)
Description:
string.format() doesn't behave correctly in some situations when used with %s and a width or a 'precision', which would add whitespaces or limit the string to a certain length.
Examples:
I don't know if that's all bugs there are, but this is clearly some unexpected behavior.
The CraftOS just seems to return the string itself, without taking the parameters into account.
I also tested it with
I'm sorry if this bug is already known, but I wasn't able to find it on the wiki or on the forums.
EDIT: Put stuff into code brackets so the spaces don't disappear
Description:
string.format() doesn't behave correctly in some situations when used with %s and a width or a 'precision', which would add whitespaces or limit the string to a certain length.
Examples:
print(string.format("%20s", "Test"))
ComputerCraft: "Test"
Lua console: " Test"
print(string.format("%-10s", "Test"))
ComputerCraft: "Test"
Lua console: "Test "
print(string.format("%.10s", "A quite long string expression."))
ComputerCraft: "A quite long string expression."
Lua console: "A quite lo"
I don't know if that's all bugs there are, but this is clearly some unexpected behavior.
The CraftOS just seems to return the string itself, without taking the parameters into account.
I also tested it with
print(string.format("%10i", 42))
ComputerCraft: " 42"
Lua console: " 42"
but everything seems to work as expected there.I'm sorry if this bug is already known, but I wasn't able to find it on the wiki or on the forums.
EDIT: Put stuff into code brackets so the spaces don't disappear