take – Why does Lua "print" print extra spaces in arguments?


I used the print() command concatenating a variable, but the output prints extra spaces. If I use io.write() , this problem doesn't occur. Why does this problem happen with print() ?


name = "Peter"

print("The length of the name is: ", #name)

Expected result: The length of the name is: 5

Result obtained: The length of the name is: 5


The print function in lua adds a tab between each argument, code describing this is available on github:


To gain more control over the output, use io.write

Scroll to Top