Comma separator in the print command appends varying spaces to separated output.

Why does the “,” separator in the print command vary the number of spaces between these two lines in the output console?

x = {“one”, “two”, “three”, label = “console”}

y = {“fee”, “fi”, “foo”, “fum”}

x.y = y – i.e. x[“y”] = y – the table y

print(‘x.y[2] =’, x.y[2]) – fi (a couple of spaces) ???
print(‘x[“y”][2] =’, x[“y”][2]) – fi (no spaces) ???

You can use append .. instead if you want to precisely control output formatting

@chrisgeeting The print statement prints values separated by a comma on tab boundaries. The tab boundaries are position 1, 5, 9, 13, 17, 21, 25, 29, etc.

Alright Dave, got it…tab boundary. Thanks!
And yes, I noticed the concatenation operator gave me more control. Thanks Jimbo!

However be aware if the item your concatenating is not a number or a string (ie, is a boolean, a table or nil) then Lua will throw an error but using a , is always safe

@TechDojo You can always call toString(x) on it to make sure you don’t get an error.