Diff

util/array.lua @ 13247:1bb4aa803b32 0.12

util.array: Fix new() library function Backport of ffe4adbd2af9 since new was added in the 0.12 branch
author Kim Alvefur <zash@zash.se>
date Sat, 22 Jul 2023 16:31:05 +0200
parent 13138:0b0cefce6e42
child 13248:db433ed3135c
line wrap: on
line diff
--- a/util/array.lua	Mon Jul 17 14:56:57 2023 +0200
+++ b/util/array.lua	Sat Jul 22 16:31:05 2023 +0200
@@ -35,7 +35,9 @@
 	return setmetatable(t or {}, array_mt);
 end
 
-array.new = new_array;
+function array.new(t)
+	return setmetatable(t or {}, array_mt);
+end
 
 function array_mt.__add(a1, a2)
 	local res = new_array();