diff --git a/!Compatibility/api/luaAPI.lua b/!Compatibility/api/luaAPI.lua index b2f0ea2..922d97a 100644 --- a/!Compatibility/api/luaAPI.lua +++ b/!Compatibility/api/luaAPI.lua @@ -32,14 +32,14 @@ function select(n, ...) end if n == "#" then - return getn(arg) + return arg.n elseif n == 1 then return unpack(arg) end local args = {} - for i = n, getn(arg) do + for i = n, arg.n do args[i-n+1] = arg[i] end @@ -182,7 +182,7 @@ function string.join(delimiter, ...) error(format("bad argument #1 to 'join' (string expected, got %s)", delimiter and type(delimiter) or "no value"), 2) end - if getn(arg) == 0 then + if arg.n == 0 then return "" end @@ -339,27 +339,27 @@ wipe = table.wipe local LOCAL_ToStringAllTemp = {} function tostringall(...) - local n = getn(arg) + local n = arg.n -- Simple versions for common argument counts - if (n == 1) then + if n == 1 then return tostring(arg[1]) - elseif (n == 2) then + elseif n == 2 then return tostring(arg[1]), tostring(arg[2]) - elseif (n == 3) then + elseif n == 3 then return tostring(arg[1]), tostring(arg[2]), tostring(arg[3]) - elseif (n == 0) then + elseif n == 0 then return end local needfix for i = 1, n do local v = arg[i] - if (type(v) ~= "string") then + if type(v) ~= "string" then needfix = i break end end - if (not needfix) then return unpack(arg) end + if not needfix then return unpack(arg) end wipe(LOCAL_ToStringAllTemp) for i = 1, needfix - 1 do @@ -377,7 +377,7 @@ local LOCAL_PrintHandler = function(...) end function setprinthandler(func) - if (type(func) ~= "function") then + if type(func) ~= "function" then error("Invalid print handler") else LOCAL_PrintHandler = func @@ -388,7 +388,7 @@ function getprinthandler() return LOCAL_PrintHandler end local function print_inner(...) local ok, err = pcall(LOCAL_PrintHandler, unpack(arg)) - if (not ok) then + if not ok then local func = geterrorhandler() func(err) end diff --git a/!DebugTools/Blizzard_DebugTools.lua b/!DebugTools/Blizzard_DebugTools.lua index ebb77dc..2c54a80 100644 --- a/!DebugTools/Blizzard_DebugTools.lua +++ b/!DebugTools/Blizzard_DebugTools.lua @@ -106,7 +106,7 @@ function EventTraceFrame_OnEvent(self, event, ...) self.framesSinceLast[nextIndex] = 0 self.eventids[nextIndex] = GetCurrentEventID() - local numArgs = getn(arg) + local numArgs = arg.n for i = 1, numArgs do if not self.args[i] then self.args[i] = {} @@ -169,7 +169,7 @@ function EventTraceFrame_OnSizeChanged(self, width, height) end end -function EventTraceFrame_Update () +function EventTraceFrame_Update() local offset = 0 local scrollBar = _G["EventTraceFrameScroll"] diff --git a/ElvUI/Libraries/CallbackHandler-1.0/CallbackHandler-1.0.lua b/ElvUI/Libraries/CallbackHandler-1.0/CallbackHandler-1.0.lua index 40b9510..7be1cd2 100644 --- a/ElvUI/Libraries/CallbackHandler-1.0/CallbackHandler-1.0.lua +++ b/ElvUI/Libraries/CallbackHandler-1.0/CallbackHandler-1.0.lua @@ -49,7 +49,7 @@ local function CreateDispatcher(argCount) return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler) end -local Dispatchers = setmetatable({}, {__index=function(self, argCount) +local Dispatchers = setmetatable({}, {__index = function(self, argCount) local dispatcher = CreateDispatcher(argCount) rawset(self, argCount, dispatcher) return dispatcher @@ -67,7 +67,7 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll RegisterName = RegisterName or "RegisterCallback" UnregisterName = UnregisterName or "UnregisterCallback" - if UnregisterAllName==nil then -- false is used to indicate "don't want this method" + if UnregisterAllName == nil then -- false is used to indicate "don't want this method" UnregisterAllName = "UnregisterAllCallbacks" end @@ -85,7 +85,7 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll local oldrecurse = registry.recurse registry.recurse = oldrecurse + 1 - Dispatchers[getn(arg) + 1](events[eventname], eventname, unpack(arg)) + Dispatchers[arg.n + 1](events[eventname], eventname, unpack(arg)) registry.recurse = oldrecurse @@ -130,24 +130,24 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll -- self["method"] calling style if type(self) ~= "table" then error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2) - elseif self==target then + elseif self == target then error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2) elseif type(self[method]) ~= "function" then error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2) end - if getn(arg)>=1 then -- this is not the same as testing for arg==nil! + if arg.n >= 1 then -- this is not the same as testing for arg==nil! regfunc = function(...) self[method](self,arg1,unpack(arg)) end else regfunc = function(...) self[method](self,unpack(arg)) end end else -- function ref with self=object or self="addonId" or self=thread - if type(self)~="table" and type(self)~="string" and type(self)~="thread" then + if type(self) ~= "table" and type(self) ~= "string" and type(self) ~= "thread" then error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string or thread expected.", 2) end - if getn(arg)>=1 then -- this is not the same as testing for arg==nil! + if arg.n >= 1 then -- this is not the same as testing for arg==nil! regfunc = function(...) method(arg1,unpack(arg)) end else regfunc = method @@ -173,7 +173,7 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll -- Unregister a callback target[UnregisterName] = function(self, eventname) - if not self or self==target then + if not self or self == target then error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2) end if type(eventname) ~= "string" then @@ -194,15 +194,15 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll -- OPTIONAL: Unregister all callbacks for given selfs/addonIds if UnregisterAllName then target[UnregisterAllName] = function(...) - if getn(arg)<1 then + if getn(arg) < 1 then error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2) end - if getn(arg)==1 and arg1==target then + if getn(arg) == 1 and arg1==target then error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2) end - for i=1,getn(arg) do + for i = 1, arg.n do local self = arg[i] if registry.insertQueue then for eventname, callbacks in pairs(registry.insertQueue) do diff --git a/ElvUI/Libraries/LibCompress/LibCompress.lua b/ElvUI/Libraries/LibCompress/LibCompress.lua index e3c88ee..0956c5d 100644 --- a/ElvUI/Libraries/LibCompress/LibCompress.lua +++ b/ElvUI/Libraries/LibCompress/LibCompress.lua @@ -81,7 +81,7 @@ local function setCleanupTables(...) if not LibCompress.frame:IsShown() then LibCompress.frame:Show() end - for i = 1, getn(arg) do + for i = 1, arg.n do tables_to_clean[(select(i, unpack(arg)))] = true end end @@ -1011,7 +1011,7 @@ function LibCompress:GetChatEncodeTable(reservedChars, escapeChars, mapChars) -- Also, because drunken status is unknown for the received, strings used with SendChatMessage should be terminated with -- an identifying byte value, after which the server MAY add "...hic!" or as much as it can fit(!). -- Pass the identifying byte as a reserved character to this function to ensure the encoding doesn't contain that value. - -- or use this: local message, match = arg1:gsub("^(.*)\029.-$", "%1") + -- or use this: local message, match = gsub(arg1, "^(.*)\029.-$", "%1") -- arg1 is message from channel, \029 is the string terminator, but may be used in the encoded datastream as well. :-) -- This encoding will expand data anywhere from: -- 0% (average with pure ascii text) diff --git a/ElvUI/Libraries/oUF/ouf.lua b/ElvUI/Libraries/oUF/ouf.lua index fe52d0c..5039f14 100644 --- a/ElvUI/Libraries/oUF/ouf.lua +++ b/ElvUI/Libraries/oUF/ouf.lua @@ -41,29 +41,29 @@ local function updateActiveUnit(self, event, unit) end local function iterateChildren(...) - for i = 1, getn(arg) do + for i = 1, arg.n do local obj = arg[i] - if(type(obj) == "table" and obj.isChild) then + 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 + if name == "unit" and value then + if self.hasChildren then iterateChildren(self:GetChildren()) end - if(not self.onlyProcessChildren) then + if not self.onlyProcessChildren then updateActiveUnit(self, "OnAttributeChanged") end - if(self.unit and self.unit == value) then + if self.unit and self.unit == value then return else - if(self.hasChildren) then + if self.hasChildren then iterateChildren(self:GetChildren()) end end @@ -79,22 +79,22 @@ Private.frame_metatable = frame_metatable for k, v in next, { UpdateElement = function(self, name) local unit = self.unit - if(not unit or not UnitExists(unit)) then return end + if not unit or not UnitExists(unit) then return end local element = elements[name] - if(not element or not self:IsElementEnabled(name) or not activeElements[self]) then return end - if(element.update) then + if not element or not self:IsElementEnabled(name) or not activeElements[self] then return end + if element.update then element.update(self, "OnShow", unit) end end, UpdateElement = function(self, name) local unit = self.unit - if(not unit or not UnitExists(unit)) then return end + if not unit or not UnitExists(unit) then return end local element = elements[name] - if(not element or not self:IsElementEnabled(name) or not activeElements[self]) then return end - if(element.update) then + if not element or not self:IsElementEnabled(name) or not activeElements[self] then return end + if element.update then element.update(self, "OnShow", unit) end end, @@ -114,12 +114,12 @@ for k, v in next, { argcheck(unit or self.unit, 3, "string", "nil") local element = elements[name] - if(not element or self:IsElementEnabled(name) or not activeElements[self]) then return end + if not element or self:IsElementEnabled(name) or not activeElements[self] then return end - if(element.enable(self, unit or self.unit)) then + if element.enable(self, unit or self.unit) then activeElements[self][name] = true - if(element.update) then + if element.update then insert(self.__elements, element.update) end end @@ -135,11 +135,11 @@ for k, v in next, { argcheck(name, 2, "string") local enabled = self:IsElementEnabled(name) - if(not enabled) then return end + if not enabled then return end local update = elements[name].update for k, func in next, self.__elements do - if(func == update) then + if func == update then remove(self.__elements, k) break end @@ -166,7 +166,7 @@ for k, v in next, { argcheck(name, 2, "string") local element = elements[name] - if(not element) then return end + if not element then return end local active = activeElements[self] return active and active[name] @@ -199,11 +199,11 @@ for k, v in next, { --]] UpdateAllElements = function(self, event) local unit = self.unit - if(not UnitExists(unit)) then return end + if not UnitExists(unit) then return end assert(type(event) == "string", "Invalid argument 'event' in UpdateAllElements.") - if(self.PreUpdate) then + if self.PreUpdate then self:PreUpdate(event) end @@ -211,7 +211,7 @@ for k, v in next, { func(self, event, unit) end - if(self.PostUpdate) then + if self.PostUpdate then self:PostUpdate(event) end end, @@ -228,34 +228,34 @@ end local secureDropdown local function InitializeSecureMenu() local unit = SecureTemplatesDropdown.unit - if(not unit) then return end + if not unit then return end local unitType = match(unit, "^([a-z]+)[0-9]+$") or unit local menu - if(unitType == "party") then + if unitType == "party" then menu = "PARTY" - elseif(UnitIsUnit(unit, "player")) then + elseif UnitIsUnit(unit, "player") then menu = "SELF" - elseif(UnitIsUnit(unit, "pet")) then + elseif UnitIsUnit(unit, "pet") then menu = "PET" - elseif(UnitIsPlayer(unit)) then - if(UnitInRaid(unit) or UnitInParty(unit)) then + elseif UnitIsPlayer(unit) then + if UnitInRaid(unit) or UnitInParty(unit) then menu = "PARTY" else menu = "PLAYER" end - elseif(UnitIsUnit(unit, "target")) then + elseif UnitIsUnit(unit, "target") then menu = "RAID_TARGET_ICON" end - if(menu) then + if menu then UnitPopup_ShowMenu(SecureTemplatesDropdown, menu, unit) end end local function togglemenu(self, unit) - if(not secureDropdown) then + if not secureDropdown then secureDropdown = CreateFrame("Frame", "SecureTemplatesDropdown", nil, "UIDropDownMenuTemplate") secureDropdown:SetID(1) @@ -263,7 +263,7 @@ local function togglemenu(self, unit) UIDropDownMenu_Initialize(secureDropdown, InitializeSecureMenu, "MENU") end - if(secureDropdown.openedFor and secureDropdown.openedFor ~= self) then + if secureDropdown.openedFor and secureDropdown.openedFor ~= self then CloseDropDownMenus() end @@ -278,8 +278,7 @@ local function onShow(self) end local function initObject(unit, style, styleFunc, header, ...) - local num = getn(arg) - for i = 1, num do + for i = 1, arg.n do local object = arg[i] local objectUnit = object.guessUnit or unit local suffix = objectUnit and match(objectUnit or unit, "%w+target") @@ -303,9 +302,9 @@ local function initObject(unit, style, styleFunc, header, ...) end end) - if(not header) then + if not header then -- Other target units are handled by :HandleUnit(). - if(suffix == "target") then + if suffix == "target" then enableTargetUpdate(object) else oUF:HandleUnit(object, unit) @@ -314,7 +313,7 @@ local function initObject(unit, style, styleFunc, header, ...) -- Used to update frames when they change position in a group. object:RegisterEvent("RAID_ROSTER_UPDATE", object.UpdateAllElements) - if(num > 1) then + if arg.n > 1 then if(object:GetParent() == header) then object.hasChildren = true else @@ -322,7 +321,7 @@ local function initObject(unit, style, styleFunc, header, ...) end end - if(suffix == "target") then + if suffix == "target" then enableTargetUpdate(object) end end @@ -356,7 +355,7 @@ local function walkObject(object, unit) local header = parent.headerType and parent -- Check if we should leave the main frame blank. - if(object.onlyProcessChildren) then + if object.onlyProcessChildren then object.hasChildren = true return initObject(unit, style, styleFunc, header, object:GetChildren()) end @@ -385,7 +384,7 @@ function oUF:RegisterMetaFunction(name, func) argcheck(name, 2, "string") argcheck(func, 3, "function", "table") - if(frame_metatable.__index[name]) then + if frame_metatable.__index[name] then return end @@ -403,8 +402,8 @@ function oUF:RegisterStyle(name, func) argcheck(name, 2, "string") argcheck(func, 3, "function", "table") - if(styles[name]) then return error("Style [%s] already registered.", name) end - if(not style) then style = name end + if styles[name] then return error("Style [%s] already registered.", name) end + if not style then style = name end styles[name] = func end @@ -417,7 +416,7 @@ Used to set the active style. --]] function oUF:SetActiveStyle(name) argcheck(name, 2, "string") - if(not styles[name]) then return error("Style [%s] does not exist.", name) end + if not styles[name] then return error("Style [%s] does not exist.", name) end style = name end @@ -452,11 +451,11 @@ do function getCondition(...) local cond = "" - for i = 1, getn(arg) do + for i = 1, arg.n do local short = select(i, unpack(arg)) local condition = conditions[short] - if(condition) then + if condition then cond = cond .. condition end end @@ -469,29 +468,29 @@ local function generateName(unit, ...) local name = "oUF_" .. gsub(style, gsub("^oUF_?", ""), gsub("[^%a%d_]+", "")) local raid, party, groupFilter - for i = 1, getn(arg), 2 do + for i = 1, arg.n, 2 do local att, val = select(i, unpack(arg)) - if(att == "showRaid") then + if att == "showRaid" then raid = true - elseif(att == "showParty") then + elseif att == "showParty" then party = true - elseif(att == "groupFilter") then + elseif att == "groupFilter" then groupFilter = val end end local append - if(raid) then - if(groupFilter) then - if(type(groupFilter) == "number" and groupFilter > 0) then + if raid then + if groupFilter then + if type(groupFilter) == "number" and groupFilter > 0 then append = groupFilter - elseif(match(groupFilter, "TANK")) then + elseif match(groupFilter, "TANK") then append = "MainTank" - elseif(match(groupFilter, "ASSIST")) then + elseif match(groupFilter, "ASSIST") then append = "MainAssist" else local _, count = gsub(groupFilter, ",", "") - if(count == 0) then + if count == 0 then append = "Raid" .. groupFilter else append = "Raid" @@ -500,19 +499,19 @@ local function generateName(unit, ...) else append = "Raid" end - elseif(party) then + elseif party then append = "Party" - elseif(unit) then + elseif unit then append = gsub(unit, "^%l", upper) end - if(append) then + if append then name = name .. append end local base = name local i = 2 - while(_G[name]) do + while _G[name] do name = base .. i i = i + 1 end @@ -530,12 +529,12 @@ do local header = self:GetParent() local unit - if(not self.onlyProcessChildren) then + if not self.onlyProcessChildren then local groupFilter = header:GetAttribute("groupFilter") - if(header:GetAttribute("showRaid")) then + if header:GetAttribute("showRaid") then unit = "raid" - elseif(header:GetAttribute("showParty")) then + elseif header:GetAttribute("showParty") then unit = "party" end @@ -582,7 +581,7 @@ do * oUF-onlyProcessChildren - can be used to force headers to only process children (boolean?) --]] function oUF:SpawnHeader(overrideName, template, visibility, ...) - if(not style) then return error("Unable to create frame. No styles have been registered.") end + if not style then return error("Unable to create frame. No styles have been registered.") end template = (template or "oUF_GroupHeaderTemplate") @@ -596,9 +595,9 @@ do header.GetAttribute = getAttribute --header:SetAttribute("template", "SecureUnitButtonTemplate") - for i = 1, getn(arg), 2 do + for i = 1, arg.n, 2 do local att, val = select(i, unpack(arg)) - if(not att) then break end + if not att then break end header:SetAttribute(att, val) end @@ -613,14 +612,14 @@ do header.initialConfigFunction = initialConfigFunction header.headerType = isPetHeader and "pet" or "group" - if(header:GetAttribute("showParty")) then + if header:GetAttribute("showParty") then self:DisableBlizzard("party") end - if(visibility) then + if visibility then local type, list = split(" ", visibility, 2) - if(list and type == "custom") then + if list and type == "custom" then RegisterStateDriver(header, "visibility", list) header.visibility = list else @@ -644,7 +643,7 @@ Used to create a single unit frame and apply the currently active style to it. --]] function oUF:Spawn(unit, overrideName) argcheck(unit, 2, "string") - if(not style) then return error("Unable to create frame. No styles have been registered.") end + if not style then return error("Unable to create frame. No styles have been registered.") end unit = lower(unit) @@ -677,7 +676,7 @@ function oUF:AddElement(name, update, enable, disable) argcheck(enable, 4, "function", "nil") argcheck(disable, 5, "function", "nil") - if(elements[name]) then return error("Element [%s] is already registered.", name) end + if elements[name] then return error("Element [%s] is already registered.", name) end elements[name] = { update = update; enable = enable; diff --git a/ElvUI/Modules/Skins/Skins.lua b/ElvUI/Modules/Skins/Skins.lua index 4b928d6..511988b 100644 --- a/ElvUI/Modules/Skins/Skins.lua +++ b/ElvUI/Modules/Skins/Skins.lua @@ -404,16 +404,6 @@ function S:HandleSliderFrame(frame) end end end - - --[[for i = 1, frame:GetNumRegions() do - local region = select(i, frame:GetRegions()) - if region and region:GetObjectType() == "FontString" then - local point, anchor, anchorPoint, x, y = region:GetPoint() - if anchorPoint:find("BOTTOM") then - E:Point(region, point, anchor, anchorPoint, x, y - 4) - end - end - end]] end end diff --git a/ElvUI_Config/Libraries/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua b/ElvUI_Config/Libraries/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua index aba6867..510f484 100644 --- a/ElvUI_Config/Libraries/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua +++ b/ElvUI_Config/Libraries/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua @@ -1926,7 +1926,7 @@ function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...) local BlizOptions = AceConfigDialog.BlizOptions local key = appName - local l = tgetn(arg) + local l = arg.n for n = 1, l do key = key .. "\001" .. arg[n] end diff --git a/ElvUI_Config/Libraries/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua b/ElvUI_Config/Libraries/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua index 3b8a70c..475e856 100644 --- a/ElvUI_Config/Libraries/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua +++ b/ElvUI_Config/Libraries/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua @@ -23,7 +23,7 @@ if not AceConfigRegistry.callbacks then end -- Lua APIs -local tinsert, tconcat, tgetn = table.insert, table.concat, table.getn +local tinsert, tconcat = table.insert, table.concat local strfind = string.find local type, tostring, pairs = type, tostring, pairs local error, assert = error, assert @@ -41,7 +41,7 @@ AceConfigRegistry.validated = { } local function err(msg, errlvl, ...) - local l = tgetn(arg) + local l = arg.n local i,j = 1,l while i < j do arg[i], arg[j] = arg[j], arg[i] diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua index f3ed7d7..088eed2 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua @@ -168,7 +168,7 @@ local function FirstFrameUpdate() end local function BuildUniqueValue(...) - local n = tgetn(arg) + local n = arg.n if n == 1 then return arg[1] else