[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: avoiding recursion in a dump_table function
- From: Dave Collins <Dave.Collins@...>
- Date: Tue, 10 May 2011 11:46:30 -0400
> function dump_table(t, prefix, seen)
> prefix = prefix or ""
> seen = seen or {}
> if seen[t] then
> print(prefix .. " is recursive")
> else
> seen[t] = t
> local k,v
> for k,v in pairs(t) do
> if(type(v) == "table") then
> dump_table(v, prefix .. k .. ":",seen)
> else
> print(prefix .. k .. "=" .. tostring(v))
> end
> end
> end
> end
Cool. What do I pass to this param 'seen'?