/
## Interface: 30100 |
## Interface: 30000 |
## Author: p3lim |
## Version: 30100.wowi:revision |
## Version: 30000.wowi:revision |
## Title: |cffff6000p|rError |
## Notes: Hide those pesky errors! |
## SavedVariables: pErrorDB |
local next = next |
local find = string.find |
local lower = string.lower |
local format = string.format |
local next = next |
local remove = table.remove |
local insert = table.insert |
local orig = UIErrorsFrame:GetScript('OnEvent') |
local function msg(...) |
print(format('|cffff8080pError:|r %s', ...)) |
end |
local function loadDefaults() |
local revert = pErrorDB2 or {} -- remove at 3.1 |
pErrorDB = setmetatable(pErrorDB or revert, {__index = {all = false, blacklist = {}}}) |
end |
local function slashCommand(str) |
str = lower(str) |
if(str == 'reset') then |
pErrorDB = {all = false, blacklist = {}} |
wipe(pErrorDB) |
loadDefaults() |
msg('Savedvariables are now reset to default') |
elseif(str == 'all') then |
pErrorDB.all = not pErrorDB.all |
else |
for k, v in next, pErrorDB.blacklist do |
if(find(str, v)) then |
tremove(pErrorDB.blacklist, k) |
remove(pErrorDB.blacklist, k) |
return msg(format('Removed |cff95ff95\'%s\'|r from the database', v)) |
end |
end |
tinsert(pErrorDB.blacklist, str) |
insert(pErrorDB.blacklist, str) |
msg(format('Added |cff95ff95\'%s\'|r to the database', str)) |
end |
else |
if(addon ~= 'pError') then return end |
self:UnregisterEvent(event) |
pErrorDB = pErrorDB or {all = false, blacklist = {}} |
loadDefaults() |
-- rollback function, remove soon! |
for k, v in next, pErrorDB.blacklist do |
remove(pErrorDB.blacklist, k) |
insert(pErrorDB.blacklist, lower(v)) |
end |
SLASH_pError1 = '/perror' |
SlashCmdList.pError = slashCommand |