Mercurial > wow > inventory
changeset 169:d367da49a490
Debug function can now print tables.
author | Zerotorescue |
---|---|
date | Tue, 25 Jan 2011 10:11:09 +0100 |
parents | 6065f48e4e47 |
children | 3350c8aa3417 |
files | Core.lua |
diffstat | 1 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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