From 3db3ec8234a1d77ad6f1fd773057efddfdc79a77 Mon Sep 17 00:00:00 2001 From: leaf corcoran Date: Sun, 1 Dec 2024 09:27:02 -0800 Subject: [PATCH] don't fail if object doesn't match class types strictly --- moonscript/util.lua | 2 +- moonscript/util.moon | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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"