show class name when dumping in front of {

This commit is contained in:
leaf corcoran 2021-03-18 11:51:52 -07:00
parent 29d8ccc53f
commit b7efcd1310
2 changed files with 9 additions and 2 deletions

View File

@ -102,7 +102,11 @@ dump = function(what)
lines = _accum_0
end
seen[what] = false
return "{\n" .. concat(lines) .. (" "):rep((depth - 1) * 4) .. "}\n"
local class_name
if what.__class then
class_name = "<" .. tostring(what.__class.__name) .. ">"
end
return tostring(class_name or "") .. "{\n" .. concat(lines) .. (" "):rep((depth - 1) * 4) .. "}\n"
else
return tostring(what) .. "\n"
end

View File

@ -70,7 +70,10 @@ dump = (what) ->
seen[what] = false
"{\n" .. concat(lines) .. (" ")\rep((depth - 1)*4) .. "}\n"
class_name = if what.__class
"<#{what.__class.__name}>"
"#{class_name or ""}{\n" .. concat(lines) .. (" ")\rep((depth - 1)*4) .. "}\n"
else
tostring(what).."\n"