The weird behavior of table.unpack

So I just run a code like this:


And the output is weird:

"hello" "hello"

The 30 in the table is disappeared. And After some test, I found that when you input args after the table.unpack, table.unpack will only output the value of the first index of the table inputed. I know I can just insert the variable to the table to fix the problem, but I’m very curious about why would this happen.

unpack() is taken as a single parameter in the print() function if you put a comma after it, and therefore only outputs the first element of the unpacked table.

What you need is table.concat(table, " ")

as i got it, this is basicqlly how lua works (wrong reply)

well there’s a posibility to get in depths and find out the actual reason (lua/luau are open source) why did it get interpreted like that, but me personally not a type of guy who can read C written source