From f8c4b941658149057c45374cea1981d009b6ab2d Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Wed, 19 Feb 2025 00:11:13 +0100 Subject: [PATCH] Add table.concat --- cf-lib/util/table.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cf-lib/util/table.lua b/cf-lib/util/table.lua index aa92228..3f829a0 100644 --- a/cf-lib/util/table.lua +++ b/cf-lib/util/table.lua @@ -68,4 +68,19 @@ function table.filter(target, predicate) end end return result +end + +--- Concatenates two tables into a new table. +--- @param table1 table The first table +--- @param table2 table The second table +--- @return table The concatenated table +function table.concat(table1, table2) + local result = {} + for _, v in pairs(table1) do + table.insert(result, v) + end + for _, v in pairs(table2) do + table.insert(result, v) + end + return result end \ No newline at end of file