Skip to content

Commit 3db3ec8

Browse files
committed
don't fail if object doesn't match class types strictly
1 parent 60094ca commit 3db3ec8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

moonscript/util.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ dump = function(what)
103103
end
104104
seen[what] = false
105105
local class_name
106-
if what.__class then
106+
if type(what.__class) == "table" and type(what.__class.__name) == "string" then
107107
class_name = "<" .. tostring(what.__class.__name) .. ">"
108108
end
109109
return tostring(class_name or "") .. "{\n" .. concat(lines) .. (" "):rep((depth - 1) * 4) .. "}\n"

moonscript/util.moon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ dump = (what) ->
7070

7171
seen[what] = false
7272

73-
class_name = if what.__class
73+
class_name = if type(what.__class) == "table" and type(what.__class.__name) == "string"
7474
"<#{what.__class.__name}>"
7575

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

0 commit comments

Comments
 (0)