Is this a bug or just unexpected behavior?

Code:

local function say(...)
	print("[test]: ",...,"!")
end 
print("hello","there","world")
say("hello","there","world")

Output:

  12:00:32.777  hello there world
  12:00:32.777  [test]:  hello !

Should I report this as a bug?

This is intentional. ... and function calls that’s not in the end of the value only gets the first value returned (or nil if no values are returned).
So say ... is 2 and 3: 1, ..., 4 will return as 1, 2, 4 while 1, ... will return 1, 2, 3

local function a(...)
    print('a', ...)
end;
local function b(...)
    print('a', ..., 'e')
end;
print(a('b', 'c', 'd')) --> a b c d
print(a('b', 'c', 'd')) --> a b e
2 Likes

What @Blockzez says is true. So in order make your idea work, you have to do something like this with the help of table.concat() and table.pack():

local function say(...)
	print("[test]: ", table.concat(table.pack(...), " "), "!")
end 
1 Like

Why do they have it like this?