函数:table.concat 数组转字符串

函数名称:数组转字符串

函数功能:将数组中的每个数据用连接符拼接成字符串

函数方法

str = table.concat(tb,sep,i, j)

参数 类型 必填 说明
tb table 待操作数组
sep string 连接符,"" 表示空字符串
i number tb[i] 起点,不写默认值为 1
j number tb[j] 终点,不写默认值为 #tb
返回值 类型 说明
str string 连接后的字符串

函数示例

tb = {"a","b","c","d",1,2,3,4}
str = table.concat(tb,"|")
dialog(str,5)
Copyright 北京帮你玩科技有限公司 2024 all right reserved,powered by Gitbook该文章修订时间: 2025-12-11 16:42:03

results matching ""

    No results matching ""