From 87f166a6be8553b33f1bccf396dfe50bc201c838 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 12 Oct 2018 00:51:52 +0200 Subject: util.array: Add freeze metamethod --- util/array.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util') 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); -- cgit v1.2.3