aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-06-20 22:47:12 +0100
committerMatthew Wild <mwild1@gmail.com>2009-06-20 22:47:12 +0100
commit7d05900c4bbe9630cc1bb93f88ea57bf7ddedde2 (patch)
treeff2bb091ef651b9903d529d2c83f6e6e4497d59e /util
parent38f157315aabc79dcb79d2bd836448ed9256c961 (diff)
downloadprosody-7d05900c4bbe9630cc1bb93f88ea57bf7ddedde2.tar.gz
prosody-7d05900c4bbe9630cc1bb93f88ea57bf7ddedde2.zip
util.array: Add support for + operator to create a new array from two arrays joined
Diffstat (limited to 'util')
-rw-r--r--util/array.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/array.lua b/util/array.lua
index 8b9102bf..05e035df 100644
--- a/util/array.lua
+++ b/util/array.lua
@@ -5,6 +5,11 @@ local function new_array(_, t)
return setmetatable(t or {}, array_mt);
end
+function array_mt.__add(a1, a2)
+ local res = new_array();
+ return res:append(a1):append(a2);
+end
+
setmetatable(array, { __call = new_array });
function array:map(func, t2)