diff options
author | sinanmohd <sinan@sinanmohd.com> | 2023-10-02 11:31:59 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2023-10-02 11:31:59 +0530 |
commit | 6523306602bd4cfaa7f78f744254a03e383ae2bf (patch) | |
tree | 79143708fcb4cd81a90a60ef1d0951d126fcc347 | |
parent | 4607e62b5459ef04dd9f407c239adedc011760dd (diff) |
lib/util: init array_merge
-rw-r--r-- | lib/util.lua | 16 |
1 files changed, 16 insertions, 0 deletions
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, |