Added new debug option, to display the addresses of tables in comments.
This commit is contained in:
parent
39dad0dadb
commit
f0670897bd
|
@ -350,10 +350,10 @@ function format_table (t, depth, l)
|
||||||
|
|
||||||
if table_info.type == TABLE_TYPE.EMPTY then
|
if table_info.type == TABLE_TYPE.EMPTY then
|
||||||
-- Empty Map
|
-- 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
|
elseif depth >= l.options.max_depth or already_visited then
|
||||||
-- Already visited or above max depth
|
-- Already visited or above max depth
|
||||||
return l '{...}'
|
return l('{'..( l.options._table_addr_comment and (' --[['..table_info.address..']] ') or '')..'...}')
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get key-value pairs, and possibly fill holes.
|
-- Get key-value pairs, and possibly fill holes.
|
||||||
|
@ -369,6 +369,7 @@ function format_table (t, depth, l)
|
||||||
|
|
||||||
-- Begin formatting table.
|
-- Begin formatting table.
|
||||||
l[#l+1] = {'indent', '{'}
|
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
|
for _, pair in ipairs(key_value_pairs) do
|
||||||
pair_format_func(l, pair[1], pair[2], depth + 1)
|
pair_format_func(l, pair[1], pair[2], depth + 1)
|
||||||
l[#l+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 = {
|
local KNOWN_OPTIONS = {
|
||||||
|
_table_addr_comment = 'boolean',
|
||||||
_all_function_info = 'boolean',
|
_all_function_info = 'boolean',
|
||||||
cut_strings = 'boolean',
|
cut_strings = 'boolean',
|
||||||
include_closure = 'boolean',
|
include_closure = 'boolean',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user