Skip to content

Commit

Permalink
don't fail if object doesn't match class types strictly
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Dec 1, 2024
1 parent 60094ca commit 3db3ec8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion moonscript/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ dump = function(what)
end
seen[what] = false
local class_name
if what.__class then
if type(what.__class) == "table" and type(what.__class.__name) == "string" then
class_name = "<" .. tostring(what.__class.__name) .. ">"
end
return tostring(class_name or "") .. "{\n" .. concat(lines) .. (" "):rep((depth - 1) * 4) .. "}\n"
Expand Down
2 changes: 1 addition & 1 deletion moonscript/util.moon
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ dump = (what) ->

seen[what] = false

class_name = if what.__class
class_name = if type(what.__class) == "table" and type(what.__class.__name) == "string"
"<#{what.__class.__name}>"

"#{class_name or ""}{\n" .. concat(lines) .. (" ")\rep((depth - 1)*4) .. "}\n"
Expand Down

0 comments on commit 3db3ec8

Please sign in to comment.