May 12, 2021 Lua
The table library consists of auxiliary functions that operate table. O ne of his main roles is to give a reasonable explanation of the size of the array in Lua. There are also functions that insert deleted elements from list, as well as sort functions for array elements.
concat is an abbreviation for concatenate (chain, connection). T he table.concat() function lists all elements in the parameter that specify the array portion of the table from the start position to the end position, separated by the specified separator (sep). E xcept for table, other parameters are not required, the default value of the separator is empty characters, the default value of start is 1, and the default value of end is the total length of the array part.
Sep, start, end these three parameters are read in order, so although they are not required parameters, but if you want to specify the back parameters, you must also specify the preceding parameters.
test = {"Tom", "Mary", "Jam","Hey"}
print(table.concat(test, ":"))
print("*************")
print(table.concat(test, nil, 1, 2))
print("*************")
print(table.concat(test, "\n", 2, 3))
print(table.maxn(test))