From a045b76ad27f3d04be4816209ccdb9144e200061 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 18 Sep 2017 17:09:03 -0700 Subject: Fixed repr to use __tostring metamethod if present. --- utils.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'utils.lua') diff --git a/utils.lua b/utils.lua index 548ce0d..dde056c 100644 --- a/utils.lua +++ b/utils.lua @@ -16,7 +16,10 @@ utils = { end local _exp_0 = type(x) if 'table' == _exp_0 then - if utils.is_list(x) then + local mt = getmetatable(x) + if mt and mt.__tostring then + return mt.__tostring(x) + elseif utils.is_list(x) then return "{" .. tostring(table.concat((function() local _accum_0 = { } local _len_0 = 1 -- cgit v1.2.3