util.array: Add freeze metamethod

This commit is contained in:
Kim Alvefur 2018-10-12 00:51:52 +02:00
parent 1789a7adf8
commit 15ba5f41b1

View file

@ -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);