Jump to content

Deeper table debugging


Rick
 Share

Recommended Posts

It looks like currently we can only go so deep in the tables/nested tables. It would be nice if we could maybe configure how far we want to go. When I'm debugging some things I can't go as deep as I'd like to and it's really limiting the debug functionality in that respect.

  • Upvote 2
Link to comment
Share on other sites

Presently I think they are limited to three layers deep, to prevent infinite loops. But there might be a way to improve this.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

The traditional way to solve infinite recursion problem in dump/copy routines (which are basically the same thing) is to keep a list of seen objects and pass it to each nested call, similar to this copy function:

 

function copy(obj, seen)
 if type(obj) ~= 'table' then return obj end
 if seen and seen[obj] then return seen[obj] end
 local s = seen or {}
 local res = setmetatable({}, getmetatable(obj))
 s[obj] = res
 for k, v in pairs(obj) do res[copy(k, s)] = copy(v, s) end
 return res
end

 

Obviously instead of returning an already seen object you would return something like "Recursion <Object ID>". In combination with a searchable debug sidebar the user could then find that object wherever it first showed up in the tree.

 

Using this method there does not need to be a depth limit.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...