Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ls- committed May 9, 2019
2 parents dcf2ff1 + 0012e03 commit 68572c9
Show file tree
Hide file tree
Showing 30 changed files with 1,030 additions and 837 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

## Version 80100.07

- Added tag editor. Can be found at /LSUI > General > Tags. Moved all of my tags to the config, if
you know Lua, you can try editing mine or creating your own. If you find any tags that stopped
working, please, report them;
- Moved colours from the profile table to the global one;
- Updated embedded oUF.

## Version 80100.06

- Removed floating combat feedback from the player frame;
Expand Down
48 changes: 43 additions & 5 deletions config/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ local MODULE = P:AddModule("Config")

-- Lua
local _G = getfenv(0)
local loadstring = _G.loadstring
local next = _G.next
local pcall = _G.pcall
local t_concat = _G.table.concat
local t_insert = _G.table.insert
local t_sort = _G.table.sort
Expand Down Expand Up @@ -571,9 +573,8 @@ do
end
end

function MODULE.SetStatusText(_, text)
function MODULE:SetStatusText(text)
local frame = AceConfigDialog.OpenFrames[addonName]

if frame then
frame:SetStatusText(text)
end
Expand All @@ -582,7 +583,6 @@ end
-- MODULE.IsTagStringValid
do
local badTags = {}
local badTag = "|cffffffff%s|r"

local function getTagName(tag)
local tagStart = (tag:match('>+()') or 2)
Expand All @@ -597,7 +597,7 @@ do

for bracket in tagString:gmatch("%[..-%]+") do
if not oUF.Tags.Methods[getTagName(bracket)] then
t_insert(badTags, badTag:format(bracket))
t_insert(badTags, "|cffffffff" .. bracket .. "|r")
end
end

Expand All @@ -613,6 +613,44 @@ do
end
end

-- MODULE.IsEventStringValid
do
local badEvents = {}
local validator = CreateFrame("Frame")

function MODULE:IsEventStringValid(eventString)
t_wipe(badEvents)

for event in eventString:gmatch('%S+') do
if not pcall(validator.RegisterEvent, validator, event) then
t_insert(badEvents, "|cffffffff" .. event .. "|r")
end
end

return #badEvents > 0 and L["INVALID_EVENTS_ERR"]:format(t_concat(badEvents, ", ")) or true
end
end

-- MODULE.IsVarStringValid
do
function MODULE:IsVarStringValid(varString)
if tonumber(varString) then
return true
else
local _, err = loadstring("return " .. varString)
return err and L["LUA_ERROR"]:format("|cffffffff" .. err .. "|r") or true
end
end
end

-- MODULE.IsFuncStringValid
do
function MODULE:IsFuncStringValid(funcString)
local _, err = loadstring("return " .. funcString)
return err and L["LUA_ERROR"]:format("|cffffffff" .. err .. "|r") or true
end
end

function MODULE:CopySettings(src, dest, ignoredKeys)
for k, v in next, dest do
if not ignoredKeys or not ignoredKeys[k] then
Expand Down Expand Up @@ -679,7 +717,7 @@ function MODULE.Init()
}

AceConfig:RegisterOptionsTable(addonName, C.options)
AceConfigDialog:SetDefaultSize(addonName, 1024, 768)
AceConfigDialog:SetDefaultSize(addonName, 1228, 768)

MODULE:CreateGeneralPanel(5)
MODULE:CreateActionBarsPanel(6)
Expand Down
Loading

0 comments on commit 68572c9

Please sign in to comment.