--- lam.dump --- dump raw lua values local m = {} local type = require("type") function m.dump (x, lvl) lvl = lvl or 0 local space = string.rep(" ", lvl*4) local out = {} if type.luatype(x) == "table" then local sub = {} for k, v in pairs(x) do if v == x then v = "self" elseif type.lamtype(v) == "environment" then v = type.string(v) else v = m.dump(v, lvl+1) end table.insert(sub, string.format("\n%s[%s] = %s,", space, k, v)) end table.insert(out, string.format("\n%s{%s\n%s}", space, table.concat(sub), space)) else table.insert(out, tostring(x)) end return table.concat(out) end -------- return m