Skip to content

Commit

Permalink
logging.lua: avoid stackoverflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lilydjwg committed Oct 17, 2012
1 parent 455746c commit 9a2d336
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lualibs/logging.lua
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ function tostring(value, visited)
else
local tmp = {}
for k, v in ipairs(value) do
table.insert(tmp, tostring(v))
table.insert(tmp, tostring(v, visited))
end
str = table.concat(tmp, ', ')
local n = #tmp

tmp = {}
for k, v in pairs(value) do
if type(k) ~= 'number' or k < 1 or k > n then
table.insert(tmp, tostring(k) .. ' = ' .. tostring(v))
table.insert(tmp, tostring(k) .. ' = ' .. tostring(v, visited))
end
end
if #tmp > 0 then
Expand Down

0 comments on commit 9a2d336

Please sign in to comment.