mirror of
https://github.com/brues-code/pfUI.git
synced 2026-11-01 16:36:56 +00:00
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:
-30
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user