diff --git a/api/api.lua b/api/api.lua index bc7e30f3..f0de9340 100644 --- a/api/api.lua +++ b/api/api.lua @@ -84,14 +84,6 @@ mod = math.mod or mod -- strsplit calls inside the pfUI environment resolve to this copy. pfUI.api.strsplit = ClassicAPI.strsplit --- [ isempty ] --- Returns true if a table is empty or not existing, otherwise false. --- 'tbl' [table] the table that shall be checked --- return: [boolean] result of the check. -function pfUI.api.isempty(tbl) - return next(tbl or {}) == nil -end - -- [ checkversion ] -- Compares a given version (major,minor,fix) and compares it to the current -- 'chkmajor' [number] the major number to check @@ -271,28 +263,6 @@ function pfUI.api.round(input, places) end end --- [ clamp ] --- Clamps a number between given range. --- 'x' [number] the number that should be clamped. --- 'min' [number] minimum value. --- 'max' [number] maximum value. --- returns: [number] clamped value: 'x', 'min' or 'max' value itself. -function pfUI.api.clamp(x, min, max) - if type(x) == "number" and type(min) == "number" and type(max) == "number" then - return x < min and min or x > max and max or x - else - return x - end -end - --- [ modf ] --- Returns integral and fractional part of a number. --- 'f' [float] the number to breakdown. --- returns: [int],[float] whole and fractional part. -function pfUI.api.modf(f) - return math.modf(f) -end - -- [ GetServerEpoch ] -- Returns a Unix epoch (seconds) representing the current server wall -- clock, packed in the player's local timezone so that date(fmt, epoch) diff --git a/modules/map.lua b/modules/map.lua index 2f6d0c4b..05bb0fd4 100644 --- a/modules/map.lua +++ b/modules/map.lua @@ -67,14 +67,14 @@ pfUI:RegisterModule("map", function () WorldMapFrame:HookScript("OnMouseWheel", function() if IsShiftKeyDown() then - alpha = clamp(WorldMapFrame:GetAlpha() + arg1/10, 0.1, 1.0) + alpha = Clamp(WorldMapFrame:GetAlpha() + arg1/10, 0.1, 1.0) WorldMapFrame:SetAlpha(alpha) end if IsControlKeyDown() then local oldscale = WorldMapFrame:GetScale() local point, rel, relpoint, offx, offy = WorldMapFrame:GetPoint() - scale = clamp(oldscale + arg1/10, 0.1, 2.0) + scale = Clamp(oldscale + arg1/10, 0.1, 2.0) -- recalculate world frame position based on old and new scale if point == "TOPLEFT" and relpoint == "TOPLEFT" then diff --git a/pfUI.lua b/pfUI.lua index a625b149..0acb886a 100644 --- a/pfUI.lua +++ b/pfUI.lua @@ -376,7 +376,7 @@ pfUI:SetScript("OnEvent", function() end -- use "Modern" as default profile on a fresh install - if pfUI.api.isempty(pfUI_init) and pfUI.api.isempty(pfUI_config) then + if TableIsEmpty(pfUI_init) and TableIsEmpty(pfUI_config) then pfUI_config = pfUI.api.CopyTable(pfUI_profiles["Modern"]) or {} end