diff --git a/moonscript/util.lua b/moonscript/util.lua index 714767e..83d7e37 100644 --- a/moonscript/util.lua +++ b/moonscript/util.lua @@ -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" diff --git a/moonscript/util.moon b/moonscript/util.moon index 9516c8b..9969ac4 100644 --- a/moonscript/util.moon +++ b/moonscript/util.moon @@ -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"