aboutsummaryrefslogtreecommitdiffstats
path: root/util/array.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-12 00:51:52 +0200
committerKim Alvefur <zash@zash.se>2018-10-12 00:51:52 +0200
commit87f166a6be8553b33f1bccf396dfe50bc201c838 (patch)
treee9d22860f36a8a6804efede7a6f84cc2656a3e4e /util/array.lua
parent3d1e573b275e8deb647508a160fa7fee603730d2 (diff)
downloadprosody-87f166a6be8553b33f1bccf396dfe50bc201c838.tar.gz
prosody-87f166a6be8553b33f1bccf396dfe50bc201c838.zip
util.array: Add freeze metamethod
Diffstat (limited to 'util/array.lua')
-rw-r--r--util/array.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/array.lua b/util/array.lua
index 1a8ffec7..4eb10f22 100644
--- a/util/array.lua
+++ b/util/array.lua
@@ -21,6 +21,8 @@ local array_base = {};
local array_methods = {};
local array_mt = { __index = array_methods, __name = "array", __tostring = function (self) return "{"..self:concat(", ").."}"; end };
+function array_mt:__freeze() return self; end
+
local function new_array(self, t, _s, _var)
if type(t) == "function" then -- Assume iterator
t = self.collect(t, _s, _var);