Fixed dict tostring to use {.x = 1} form instead of {x: 1}

This commit is contained in:
Bruce Hill 2019-01-16 16:44:16 -08:00
parent 1cbf9f3e07
commit 75bb8979ae
2 changed files with 4 additions and 4 deletions

View File

@ -281,7 +281,7 @@ local _dict_mt = {
local _accum_0 = { }
local _len_0 = 1
for k, v in pairs(self) do
_accum_0[_len_0] = tostring(as_nomsu(k)) .. ": " .. tostring(as_nomsu(v))
_accum_0[_len_0] = "." .. tostring(k) .. " = " .. tostring(v)
_len_0 = _len_0 + 1
end
return _accum_0
@ -292,7 +292,7 @@ local _dict_mt = {
local _accum_0 = { }
local _len_0 = 1
for k, v in pairs(self) do
_accum_0[_len_0] = tostring(as_nomsu(k)) .. ": " .. tostring(as_nomsu(v))
_accum_0[_len_0] = "." .. tostring(as_nomsu(k)) .. " = " .. tostring(as_nomsu(v))
_len_0 = _len_0 + 1
end
return _accum_0

View File

@ -121,9 +121,9 @@ _dict_mt =
for _ in pairs(@) do n += 1
return n
__tostring: =>
"{"..concat(["#{as_nomsu(k)}: #{as_nomsu(v)}" for k,v in pairs @], ", ").."}"
"{"..concat([".#{k} = #{v}" for k,v in pairs @], ", ").."}"
as_nomsu: =>
"{"..concat(["#{as_nomsu(k)}: #{as_nomsu(v)}" for k,v in pairs @], ", ").."}"
"{"..concat([".#{as_nomsu(k)} = #{as_nomsu(v)}" for k,v in pairs @], ", ").."}"
as_lua: =>
"Dict{"..concat(["[ #{as_lua(k)}]= #{as_lua(v)}" for k,v in pairs @], ", ").."}"
__band: (other)=>