From 4607e62b5459ef04dd9f407c239adedc011760dd Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Mon, 2 Oct 2023 11:08:50 +0530 Subject: lib/uril/table_merge: dont modify arg table --- lib/util.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/util.lua b/lib/util.lua index 8ea7699..fc61182 100644 --- a/lib/util.lua +++ b/lib/util.lua @@ -1,14 +1,18 @@ #!/usr/bin/env lua local table_merge = function (t1, t2) + local t = {} t1 = t1 or {} t2 = t2 or {} + for k, v in pairs(t1) do + t[k] = v + end for k, v in pairs(t2) do - t1[k] = v + t[k] = v end - return t1 + return t end local table_print = function (t) -- cgit v1.2.3