Feature Overview
CAT() concatenates two or more tables.
- The second and subsequent arguments are added to the table elements of the first argument.
- Returns a concatenated table.
- The table used for the first argument is updated. (destructive)
- This function consumes 39 Token.
local tbl_1 = {'a'} local tbl_2 = {'b', 'c'} cat(tbl_1, tbl_2) ?tbl_1[1] -- a ?tbl_1[2] -- b ?tbl_1[3] -- c -- Only primary elements can be cloned by specifying an empty table for the first argument. local tbl = {1, 2, 3} local tbl_dup = cat({}, tbl) tbl[1] = 256 ?tbl_dup[1] -- 1 ?tbl_dup[2] -- 2 ?tbl_dup[3] -- 3 |
See the code in the cartridge for further examples.
may want to Use DMP() if check the converted table.
This function is included in the KNUTIL library.
[Please log in to post a comment]