-- table.concat(table,sep,start,end)
>tb1 = {"alpha","beta","gamma"}
>print( table.concat(tb1,":"))
alpha:beta:gamma
> print(table.concat(tb1,nil,1,2))
alphabeta
> print(table.concat(tb1,"\n",2,3))
beta
gamma
table.insert(table, pos, value)
table.insert()函数在table的数组部分指定位置(pos)插入值为value的一个元素. pos参数可选, 默认为数组部分末尾.
> tbl = {"alpha", "beta", "gamma"}
> table.insert(tbl, "delta")
> table.insert(tbl, "epsilon")
> print(table.concat(tbl, ", ")
alpha, beta, gamma, delta, epsilon
> table.insert(tbl, 3, "zeta")
> print(table.concat(tbl, ", ")
alpha, beta, zeta, gamma, delta, epsilon