|
I’ve got a large object which, for convenience of pulling data from it, is self-referencing. (sometimes I need items from a dept, sometimes I need all items). Essentially, I’ve got this: Flyer Departments Dept1 Item1 Item2 Dept2 Item3 Item4 Items Item1 Item2 Item3 Item4 When I need to look inside this table using the following dump_table method, I get infinite recursion. Any ideas on how I can add some smarts to my dump_table to defeat the infinite recursion? function dump_table(t, prefix) if(prefix == nil) then prefix = "" end local k,v for k,v in pairs(t) do if(type(v) == "table") then dump_table(v, prefix .. k .. ":") else print(prefix .. k .. "=" .. tostring(v)) end end end Dave Collins Front-End Engineer Mercatus Technologies Inc. dave.collins@mercatustechnologies.com |