From 6523306602bd4cfaa7f78f744254a03e383ae2bf Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Mon, 2 Oct 2023 11:31:59 +0530 Subject: lib/util: init array_merge --- lib/util.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/util.lua b/lib/util.lua index fc61182..9f8cb22 100644 --- a/lib/util.lua +++ b/lib/util.lua @@ -15,6 +15,21 @@ local table_merge = function (t1, t2) return t end +local array_merge = function (a1, a2) + local a = {} + a1 = a1 or {} + a2 = a2 or {} + + for _, v in ipairs(a1) do + a[#a + 1] = v + end + for _, v in ipairs(a2) do + a[#a + 1] = v + end + + return a +end + local table_print = function (t) for k, v in pairs(t) do print( '|'.. k .. '=' .. v .. '|') @@ -164,6 +179,7 @@ return { table_merge = table_merge, table_print = table_print, table_match_or_any = table_match_or_any, + array_merge = array_merge, zip_ext_first = zip_ext_first, string_vid_path_to_name = string_vid_path_to_name, opensubtitles_hash = opensubtitles_hash, -- cgit v1.2.3