unpack它接受一个数组(table)作为参数,并默认从下标1开始返回数组的所有元素,例子代码如下:
do
arrayData = {"a", "b", "c", "d", "e"};
function returnMoreValues()
return 1, 2, 3;
end
a, b, c = returnMoreValues();
--print(a, b, c);
--print((returnMoreValues()));
--print(arrayData); -- print the address of the arrayData
--print(unpack(arrayData)); -- print all the elements of the arrayData
print(unpack(arrayData, 2)); --the second param is the index of the arrayData
end