--- lam.pp local pp = {} local type = require "type" local unpack = table.unpack or unpack function pp.dump (x, lvl) lvl = lvl or 0 local space = string.rep(" ", lvl) local output = "" --[[if getmetatable(x) and getmetatable(x).__tostring then output = output .. tostring(x) else]]if type.luatype(x) == "table" then local subo = "" for k,v in pairs(x) do if v == x then v = "self" else v = pp.dump(v, lvl+2) end subo = subo .. string.format("\n%s[%s] = %s,", (space.." "), k, v) end output = output .. string.format("\n%s{%s\n%s}", space, subo, space) else output = output .. tostring(x) end return output end function pp.pp (x) print(pp.dump(x)) end --- return pp