diff --git a/pretty.lua b/pretty.lua index 324dd59..8dc5fa1 100644 --- a/pretty.lua +++ b/pretty.lua @@ -350,10 +350,10 @@ function format_table (t, depth, l) if table_info.type == TABLE_TYPE.EMPTY then -- Empty Map - return l '{}' + return l('{'..( l.options._table_addr_comment and (' --[['..table_info.address..']] ') or '')..'}') elseif depth >= l.options.max_depth or already_visited then -- Already visited or above max depth - return l '{...}' + return l('{'..( l.options._table_addr_comment and (' --[['..table_info.address..']] ') or '')..'...}') end -- Get key-value pairs, and possibly fill holes. @@ -369,6 +369,7 @@ function format_table (t, depth, l) -- Begin formatting table. l[#l+1] = {'indent', '{'} + if l.options._table_addr_comment then l[#l+1], l[#l+2] = '--[['..table_info.address..']]', {'seperator'} end for _, pair in ipairs(key_value_pairs) do pair_format_func(l, pair[1], pair[2], depth + 1) l[#l+1] = ',' @@ -490,9 +491,10 @@ setmetatable(StringBuilder, { -------------------------------------------------------------------------------- -local DEBUG_OPTIONS = { _all_function_info = true } +local DEBUG_OPTIONS = { _all_function_info = true, _table_addr_comment = true } local KNOWN_OPTIONS = { + _table_addr_comment = 'boolean', _all_function_info = 'boolean', cut_strings = 'boolean', include_closure = 'boolean',