这是我所看到的:
> function test(...)
>> for i, v in ipairs({...}) do
>> print(v)
>> end
>>end
-- This is expected
> test(unpack({1,2}))
1
2
-- When I mix unpack and regular arguments
-- What happened to 2?
> test(unpack({1,2}), 3)
1
3
-- What happened to 3?
> test(unpack({}), 3)
-- When I put regular args before unpack, everything is fine:
> test(1, unpack({2, 3}))
1
2
3
当我将未打包的参数与常规参数混合使用时,结果很奇怪。你能解释一下发生了什么吗?