# HG changeset patch # User Kim Alvefur # Date 1539298312 -7200 # Node ID 4e38121a349d915498f4ef76977b0296c152d1bd # Parent 20aad01089998953bf4ca1411aacccdf48c92ec6 util.array: Add freeze metamethod diff -r 20aad0108999 -r 4e38121a349d util/array.lua --- 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);