# HG changeset patch # User Zerotorescue # Date 1295946669 -3600 # Node ID d367da49a490be487a58784a67d42d9e9519716f # Parent 6065f48e4e478a371c36a36eb50d55c5b833f9d9 Debug function can now print tables. diff -r 6065f48e4e47 -r d367da49a490 Core.lua --- a/Core.lua Tue Jan 25 09:55:04 2011 +0100 +++ b/Core.lua Tue Jan 25 10:11:09 2011 +0100 @@ -507,6 +507,22 @@ -- Debug +local function ReadableTable(t) + local temp = ""; + + for i, v in pairs(t) do + temp = temp .. " {"; + if type(v) == "table" then + temp = temp .. ReadableTable(v) .. ","; + else + temp = temp .. tostring(v) .. ","; + end + temp = temp .. "}"; + end + + return temp; +end + function addon:Debug(t, ...) if not self.debugChannel and self.debugChannel ~= false then -- We want to check just once, so if you add a debug channel later just do a /reload (registering an event for this is wasted resources) @@ -522,6 +538,10 @@ end if self.debugChannel then + if type(t) == "table" then + t = ReadableTable(t); + end + self.debugChannel:AddMessage("|cffffff00Inventorium|r:" .. sformat(t, ...)); end end