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
commit15ba5f41b17393bd610a547b3c62312986b9efc5 (patch)
treee9d22860f36a8a6804efede7a6f84cc2656a3e4e /util/array.lua
parent1789a7adf85b8c3467941d5962630745fbdac723 (diff)
downloadprosody-15ba5f41b17393bd610a547b3c62312986b9efc5.tar.gz
prosody-15ba5f41b17393bd610a547b3c62312986b9efc5.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);