Replace pfUI's clamp/isempty/modf with ClassicAPI's Clamp/TableIsEmpty

The world map's shift/ctrl wheel alpha and scale use Clamp, and the
fresh-install profile check uses TableIsEmpty (pfUI_init and pfUI_config
are always tables by then). modf only wrapped math.modf and had no callers.
This commit is contained in:
Brues
2026-10-31 15:47:52 -05:00
parent 3b64bfa98b
commit 2b7febf617
3 changed files with 3 additions and 33 deletions
-30
View File
@@ -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)