Software /
code /
prosody
Changeset
9487:4e38121a349d
util.array: Add freeze metamethod
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 12 Oct 2018 00:51:52 +0200 |
parents | 9486:20aad0108999 |
children | 9488:a96a2fbcc6c0 |
files | util/array.lua |
diffstat | 1 files changed, 2 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/util/array.lua Fri Oct 12 00:15:08 2018 +0200 +++ b/util/array.lua Fri Oct 12 00:51:52 2018 +0200 @@ -21,6 +21,8 @@ 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);