John@47: local bsk=bsk John@44: local pairs=pairs John@47: local tostring=tostring John@44: local type=type John@44: local getmetatable=getmetatable John@44: local setmetatable=setmetatable John@44: John@44: setfenv(1,bsk) John@44: John@44: -- These two functions properly format the call to AceConsole:Print(), which John@44: -- needs a full object. Calling "Print" will call the mixed-in console functions John@44: -- but without a self parameter because of the namespacing. I would disembed John@44: -- console, except that it has handy OnDisable behavior to disable chat John@44: -- commands. John@44: function print(...) John@44: bsk:Print(...) John@44: end John@44: John@44: function printf(...) John@44: bsk:Printf(...) John@44: end John@44: John@44: function tcopy(to, from) John@44: for k,v in pairs(from) do John@44: if(type(v)=="table") then John@44: to[k] = {} John@44: tcopy(to[k], v); John@44: else John@44: to[k] = v; John@44: end John@44: end John@44: end John@44: John@44: function shallowCopy(t) John@44: local u = { } John@44: for k, v in pairs(t) do u[k] = v end John@44: return setmetatable(u, getmetatable(t)) John@44: end John@44: John@44: function PrintTable(table, depth) John@44: depth = depth or "" John@44: if not table then return end John@44: if #depth > 3*5 then print(depth.."Recursion too deep - stopping"); return end John@44: for i,v in pairs(table) do John@44: if( type(v) == "string" ) then John@44: print(depth .. i .. " - " .. v) John@44: elseif( type(v) == "number" ) then John@44: print(depth .. i .. " - " .. tostring(v)) John@44: elseif( type(v) == "table" ) then John@48: --if v == table then return end John@48: print(depth .. tostring(i) .." - ") John@44: PrintTable(v,depth.." ") John@44: elseif( type(v) == "boolean" ) then John@44: print(depth .. i .. " - " .. tostring(v)) John@44: elseif( type(v) == "function" ) then John@44: print(depth .. "function " .. i .. "()") John@44: else John@44: print(depth .. i .. " - not sure how to print type: " .. type(v) ) John@44: end John@44: end John@44: end John@44: