Diff

util/array.lua @ 13032:ea4923bebca9

util.array: Change tostring format to [a,b,c] Arrays in Lua do use { } but since __tostring is often user-facing it seems sensible to use [ ] instead for consistency with many other systems; as well as to allow the {a,b,c} formatting to be used by util.set without being confused with util.array.
author Kim Alvefur <zash@zash.se>
date Thu, 06 Apr 2023 16:27:37 +0200
parent 12975:d10957394a3c
child 13141:451cb119026e
line wrap: on
line diff
--- a/util/array.lua	Thu Apr 06 15:03:45 2023 +0100
+++ b/util/array.lua	Thu Apr 06 16:27:37 2023 +0200
@@ -24,7 +24,7 @@
 local array_mt = {
 	__index = array_methods;
 	__name = "array";
-	__tostring = function (self) return "{"..self:concat(", ").."}"; end;
+	__tostring = function (self) return "["..self:concat(", ").."]"; end;
 };
 
 function array_mt:__freeze() return self; end