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
commit8a5486f7fd02d522285b4a84626334e814130905 (patch)
treee9d22860f36a8a6804efede7a6f84cc2656a3e4e /util/array.lua
parentffe8fb44641ba64697fd64ae06819dc2e0c8f689 (diff)
downloadprosody-8a5486f7fd02d522285b4a84626334e814130905.tar.gz
prosody-8a5486f7fd02d522285b4a84626334e814130905.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);