aboutsummaryrefslogtreecommitdiffstats
path: root/util/array.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-03-16 23:49:27 +0100
committerKim Alvefur <zash@zash.se>2017-03-16 23:49:27 +0100
commit3e5d5895f9365fbecf497d9080f8f5705a3266a6 (patch)
tree5d9e9dfec7020f862dc40a4b872556e3661b5327 /util/array.lua
parent5b35a9ffb3c7d9cc46c10d788b1dd573f11b1688 (diff)
parenta374056fa56185322141484732d963abdee02941 (diff)
downloadprosody-3e5d5895f9365fbecf497d9080f8f5705a3266a6.tar.gz
prosody-3e5d5895f9365fbecf497d9080f8f5705a3266a6.zip
Merge 0.10->trunk
Diffstat (limited to 'util/array.lua')
-rw-r--r--util/array.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/util/array.lua b/util/array.lua
index ea520f6b..05fa97ca 100644
--- a/util/array.lua
+++ b/util/array.lua
@@ -33,6 +33,19 @@ function array_mt.__add(a1, a2)
return res:append(a1):append(a2);
end
+function array_mt.__eq(a, b)
+ if #a == #b then
+ for i = 1, #a do
+ if a[i] ~= b[i] then
+ return false;
+ end
+ end
+ else
+ return false;
+ end
+ return true;
+end
+
setmetatable(array, { __call = new_array });
-- Read-only methods