function table.len(t) local count = 0 for _ in pairs(t) do count = count + 1 end return count end function table.pprint(t, ident, total_count) local ident = ident or 0 local total_count = total_count or 0 if type(t) == 'table' then local count = 0 for k, v in pairs(t) do print(string.rep('\t', ident) .. k) count = count + 1 total_count = pprint(v, ident + 1, total_count) end if count == 0 then --print('') end else print(string.rep('\t', ident) .. tostring(t)) total_count = total_count + 1 end return total_count end