Skip to content
Permalink
Browse files
show class name when dumping in front of {
  • Loading branch information
leafo committed Mar 18, 2021
1 parent 29d8ccc commit b7efcd131046ed921ae1075d7c0f6a3b64a570f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
@@ -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
@@ -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"

0 comments on commit b7efcd1

Please sign in to comment.