Lua UnPack函数用法实例
时间:2021-03-07 10:30:41|栏目:|点击: 次
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
上一篇:ServU7不支持中文名的解决办法(Serv-U中文目录和文件名变乱码问题)
栏 目:
下一篇:Powershell小技巧之通过EventLog查看近期电脑开机和关机时间
本文标题:Lua UnPack函数用法实例
本文地址:http://www.codeinn.net/misctech/75904.html






