Skip to content

Commit

Permalink
Update .luacheckrc
Browse files Browse the repository at this point in the history
  • Loading branch information
Oppzippy committed Oct 14, 2019
1 parent 291d81a commit 3cd4754
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 29 deletions.
8 changes: 1 addition & 7 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@ max_line_length = false
exclude_files = {
"**/Libs",
}
only = {
"011", -- syntax
"1", -- globals
}
ignore = {
"11/SLASH_.*", -- slash handlers
"1/[A-Z][A-Z][A-Z0-9_]+", -- three letter+ constants
"212", -- Unused argument
}

globals = {
"LibStub",
"UpdateOnBarHighlightMarksBySpell",
Expand Down
6 changes: 3 additions & 3 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ do
elseif searchType == "parentFrames" then
text = self:GetMouseoverFramesText()
elseif searchType == "mouseFocus" then
local frame = GetMouseFocus()
if frame and frame ~= WorldFrame then
text = self:GetSpecificFrameText(frame)
local focusFrame = GetMouseFocus()
if focusFrame and focusFrame ~= WorldFrame then
text = self:GetSpecificFrameText(focusFrame)
end
else
self:Print(L.invalidSearchType:format(searchType))
Expand Down
30 changes: 12 additions & 18 deletions FontStringFinder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ do
local frame = EnumerateFrames()
while frame do
local regions = { frame:GetRegions() }
for i, region in next, regions do
for _, region in next, regions do
-- much faster to check if GetText than to use GetObjectType and check if FontString
if region.GetText and condition(region) then
fontStrings[#fontStrings+1] = region
Expand Down Expand Up @@ -123,21 +123,15 @@ do
end
end

do
local function filter(fontString)
return fontString:IsVisible()
end

-- Returns all text from all frames under the cursor.
-- @return string containing all text from frames under the cursor.
function addon:GetMouseoverFramesText()
local frames = self:GetMouseoverFrames()
local texts = {}
for _, frame in ipairs(frames) do
texts[#texts+1] = self:GetSpecificFrameText(frame)
end
return table.concat(texts, "\n")
-- Returns all text from all frames under the cursor.
-- @return string containing all text from frames under the cursor.
function addon:GetMouseoverFramesText()
local frames = self:GetMouseoverFrames()
local texts = {}
for _, frame in ipairs(frames) do
texts[#texts+1] = self:GetSpecificFrameText(frame)
end
return table.concat(texts, "\n")
end

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -186,11 +180,11 @@ end
function addon:FontStringsToString(fontStrings)
local texts = {}
local foundOne = false
for i, f in ipairs(fontStrings) do
local text = f:GetText()
for _, fs in ipairs(fontStrings) do
local text = fs:GetText()
if text then
foundOne = true
texts[#texts+1] = text
texts[#texts+1] = text
end
end
return foundOne and table.concat(texts, "\n")
Expand Down
2 changes: 1 addition & 1 deletion TableUtils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ end
-- @return Reduced value.
function tableUtils.Reduce(t, reducer)
local accumulator = nil
for i, current in ipairs(t) do
for _, current in ipairs(t) do
accumulator = reducer(accumulator, current)
end
return accumulator
Expand Down

0 comments on commit 3cd4754

Please sign in to comment.