连接table元素为字符串
function rconcat(l)
	if type(l) ~= "table" then return l end
	local res = {}
	for i=1,#l do
		res[i] = rconcat(l[i])
	end

	return table.concat(res,' ')
end
print(rconcat( {{'i','am'},{{'boy'},{','},{'you','are'},'girl'}}))


深度访问叠加层次的table的元素来链接

concat第二个可选参数,指定间隔字符串,第三第四个为 开始位置,结束位置


首页 我的博客
粤ICP备17103704号