diff --git a/ElvUI/Core/Movers.lua b/ElvUI/Core/Movers.lua index 946b77a..ad6c141 100644 --- a/ElvUI/Core/Movers.lua +++ b/ElvUI/Core/Movers.lua @@ -338,9 +338,7 @@ function E:CreateMover(parent, name, text, overlay, snapoffset, postdrag, moverT E.CreatedMovers[name]["shouldDisable"] = shouldDisable E.CreatedMovers[name]["type"] = {} - local types = {split(",", moverTypes)} - for i = 1, getn(types) do - local moverType = types[i] + for _, moverType in {split(",", moverTypes)} do E.CreatedMovers[name]["type"][moverType] = true end end diff --git a/ElvUI/Core/core.lua b/ElvUI/Core/core.lua index eb12577..38bfc24 100644 --- a/ElvUI/Core/core.lua +++ b/ElvUI/Core/core.lua @@ -931,7 +931,7 @@ function E:RegisterModule(name, loadFunc) --Add module name to registry self.ModuleCallbacks[name] = true - self.ModuleCallbacks["CallPriority"][getn(self.ModuleCallbacks["CallPriority"]) + 1] = name + tinsert(self.ModuleCallbacks["CallPriority"], name) --Register loadFunc to be called when event is fired E:RegisterCallback(name, loadFunc, E:GetModule(name)) @@ -941,7 +941,7 @@ function E:RegisterModule(name, loadFunc) if self.initialized then self:GetModule(name):Initialize() else - self["RegisteredModules"][getn(self["RegisteredModules"]) + 1] = name + tinsert(self["RegisteredModules"], name) end end end @@ -957,13 +957,13 @@ function E:RegisterInitialModule(name, loadFunc) --Add module name to registry self.InitialModuleCallbacks[name] = true - self.InitialModuleCallbacks["CallPriority"][getn(self.InitialModuleCallbacks["CallPriority"]) + 1] = name + tinsert(self.InitialModuleCallbacks["CallPriority"], name) --Register loadFunc to be called when event is fired E:RegisterCallback(name, loadFunc, E:GetModule(name)) --Old deprecated initialize method else - self["RegisteredInitialModules"][getn(self["RegisteredInitialModules"]) + 1] = name + tinsert(self["RegisteredInitialModules"], name) end end diff --git a/ElvUI/Libraries/AceSerializer-3.0/AceSerializer-3.0.lua b/ElvUI/Libraries/AceSerializer-3.0/AceSerializer-3.0.lua index f6e1b0c..ab9ab03 100644 --- a/ElvUI/Libraries/AceSerializer-3.0/AceSerializer-3.0.lua +++ b/ElvUI/Libraries/AceSerializer-3.0/AceSerializer-3.0.lua @@ -117,8 +117,7 @@ function AceSerializer:Serialize(...) local nres = 1 for i = 1, arg.n do - local v = select(i, unpack(arg)) - nres = SerializeValue(v, serializeTbl, nres) + nres = SerializeValue(arg[i], serializeTbl, nres) end serializeTbl[nres+1] = "^^" -- "^^" = End of serialized data diff --git a/ElvUI/Libraries/LibItemSearch-1.2/LibItemSearch-1.2.lua b/ElvUI/Libraries/LibItemSearch-1.2/LibItemSearch-1.2.lua index 43cd1af..7c9a97c 100644 --- a/ElvUI/Libraries/LibItemSearch-1.2/LibItemSearch-1.2.lua +++ b/ElvUI/Libraries/LibItemSearch-1.2/LibItemSearch-1.2.lua @@ -14,6 +14,7 @@ end local pairs, select, tonumber = pairs, select, tonumber local find, gsub, match, lower = string.find, string.gsub, string.match, string.lower +local getn = table.getn local GetItemInfo = GetItemInfo diff --git a/ElvUI/Libraries/oUF/ouf.lua b/ElvUI/Libraries/oUF/ouf.lua index 82586ca..751dd0f 100644 --- a/ElvUI/Libraries/oUF/ouf.lua +++ b/ElvUI/Libraries/oUF/ouf.lua @@ -36,41 +36,6 @@ local function enableTargetUpdate(object) end Private.enableTargetUpdate = enableTargetUpdate -local function updateActiveUnit(self, event, unit) - return true -end - -local function iterateChildren(...) - for i = 1, getn(arg) do - local obj = arg[i] - - if(type(obj) == "table" and obj.isChild) then - updateActiveUnit(obj, "iterateChildren") - end - end -end - -local function onAttributeChanged(self, name, value) - if(name == "unit" and value) then - if(self.hasChildren) then - iterateChildren(self:GetChildren()) - end - - if(not self.onlyProcessChildren) then - updateActiveUnit(self, "OnAttributeChanged") - end - - if(self.unit and self.unit == value) then - return - else - if(self.hasChildren) then - iterateChildren(self:GetChildren()) - end - end - - end -end - local frame_metatable = { __index = CreateFrame("Button") } @@ -278,7 +243,7 @@ local function onShow(self) end local function initObject(unit, style, styleFunc, header, ...) - local num = getn(arg) + local num = arg.n for i = 1, num do local object = arg[i] local objectUnit = object.guessUnit or unit @@ -452,8 +417,8 @@ do function getCondition(...) local cond = "" - for i = 1, getn(arg) do - local short = select(i, unpack(arg)) + for i = 1, arg.n do + local short = arg[i] local condition = conditions[short] if(condition) then diff --git a/ElvUI/Libraries/oUF/private.lua b/ElvUI/Libraries/oUF/private.lua index 7dc3a17..8667efa 100644 --- a/ElvUI/Libraries/oUF/private.lua +++ b/ElvUI/Libraries/oUF/private.lua @@ -5,8 +5,7 @@ function Private.argcheck(value, num, ...) assert(type(num) == 'number', "Bad argument #2 to 'argcheck' (number expected, got " .. type(num) .. ')') for i = 1, arg.n do - -- if(type(value) == arg[i]) then return end - if(type(value) == select(i, unpack(arg))) then return end + if(type(value) == arg[i]) then return end end local types = strjoin(', ', unpack(arg)) diff --git a/ElvUI/Libraries/oUF_Plugins/oUF_GPS/oUF_GPS.lua b/ElvUI/Libraries/oUF_Plugins/oUF_GPS/oUF_GPS.lua index dc75259..8a78e6c 100644 --- a/ElvUI/Libraries/oUF_Plugins/oUF_GPS/oUF_GPS.lua +++ b/ElvUI/Libraries/oUF_Plugins/oUF_GPS/oUF_GPS.lua @@ -3,7 +3,7 @@ local oUF = ns.oUF assert(oUF, "oUF not loaded") local cos, sin, sqrt2, max, atan2 = math.cos, math.sin, math.sqrt(2), math.max, math.atan2 -local tinsert, tremove = table.insert, table.remove +local getn, tinsert, tremove = table.getn, table.insert, table.remove local pi2 = 3.141592653589793 / 2 local GetPlayerMapPosition = GetPlayerMapPosition diff --git a/ElvUI/Modules/Auras/Auras.lua b/ElvUI/Modules/Auras/Auras.lua index 1dc3c48..7eefce7 100644 --- a/ElvUI/Modules/Auras/Auras.lua +++ b/ElvUI/Modules/Auras/Auras.lua @@ -9,7 +9,7 @@ local _G = _G local unpack, select, pairs, ipairs = unpack, select, pairs, ipairs local floor, min, max, huge = math.floor, math.min, math.max, math.huge local format = string.format -local wipe, tinsert, tsort, tremove = table.wipe, table.insert, table.sort, table.remove +local getn, wipe, tinsert, tsort, tremove = table.getn, table.wipe, table.insert, table.sort, table.remove --WoW API / Variables local CreateFrame = CreateFrame local GetInventoryItemQuality = GetInventoryItemQuality diff --git a/ElvUI/Modules/Bags/Sort.lua b/ElvUI/Modules/Bags/Sort.lua index 703a17b..87eb7de 100644 --- a/ElvUI/Modules/Bags/Sort.lua +++ b/ElvUI/Modules/Bags/Sort.lua @@ -5,7 +5,7 @@ local Search = LibStub("LibItemSearch-1.2"); --Cache global variables --Lua functions local ipairs, pairs, pcall, tonumber, select, unpack = ipairs, pairs, pcall, tonumber, select, unpack -local tinsert, tremove, tsort, twipe = table.insert, table.remove, table.sort, table.wipe +local getn, tinsert, tremove, tsort, twipe = table.getn, table.insert, table.remove, table.sort, table.wipe local floor, mod = math.floor, math.mod local band = bit.band local match, gmatch, find = string.match, string.gmatch, string.find diff --git a/ElvUI/Modules/Skins/Blizzard/Craft.lua b/ElvUI/Modules/Skins/Blizzard/Craft.lua index ac4eb4e..80cb9d8 100644 --- a/ElvUI/Modules/Skins/Blizzard/Craft.lua +++ b/ElvUI/Modules/Skins/Blizzard/Craft.lua @@ -1,5 +1,5 @@ -local E, L, V, P, G = unpack(ElvUI) --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB -local S = E:GetModule("Skins") +local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB +local S = E:GetModule("Skins"); --Cache global variables --Lua functions diff --git a/ElvUI/Modules/Skins/Blizzard/TradeSkill.lua b/ElvUI/Modules/Skins/Blizzard/TradeSkill.lua index c7dc68d..cacaf4b 100644 --- a/ElvUI/Modules/Skins/Blizzard/TradeSkill.lua +++ b/ElvUI/Modules/Skins/Blizzard/TradeSkill.lua @@ -1,5 +1,5 @@ -local E, L, V, P, G = unpack(ElvUI) --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB -local S = E:GetModule("Skins") +local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB +local S = E:GetModule("Skins"); --Cache global variables --Lua functions diff --git a/ElvUI/Modules/Skins/Skins.lua b/ElvUI/Modules/Skins/Skins.lua index 4b928d6..792943e 100644 --- a/ElvUI/Modules/Skins/Skins.lua +++ b/ElvUI/Modules/Skins/Skins.lua @@ -535,7 +535,7 @@ function S:AddCallbackForAddon(addonName, eventName, loadFunc, forceLoad, bypass else --Insert eventName in this addons' registry self.addonCallbacks[addonName][eventName] = true - self.addonCallbacks[addonName]["CallPriority"][getn(self.addonCallbacks[addonName]["CallPriority"]) + 1] = eventName + tinsert(self.addonCallbacks[addonName]["CallPriority"], eventName) end end @@ -558,7 +558,7 @@ function S:AddCallback(eventName, loadFunc) --Add event name to registry self.nonAddonCallbacks[eventName] = true - self.nonAddonCallbacks["CallPriority"][getn(self.nonAddonCallbacks["CallPriority"]) + 1] = eventName + tinsert(self.nonAddonCallbacks["CallPriority"], eventName) --Register loadFunc to be called when event is fired E.RegisterCallback(E, eventName, loadFunc) diff --git a/ElvUI/Modules/Tooltip/Tooltip.lua b/ElvUI/Modules/Tooltip/Tooltip.lua index 56fd017..0c8d0dd 100644 --- a/ElvUI/Modules/Tooltip/Tooltip.lua +++ b/ElvUI/Modules/Tooltip/Tooltip.lua @@ -5,7 +5,7 @@ local TT = E:NewModule("Tooltip", "AceHook-3.0", "AceEvent-3.0"); --Lua functions local _G = _G local unpack = unpack -local twipe, tinsert, tconcat = table.wipe, table.insert, table.concat +local getn, twipe, tinsert, tconcat = table.getn, table.wipe, table.insert, table.concat local floor = math.floor local find, format, match = string.find, string.format, string.match --WoW API / Variables