Module:Number: Difference between revisions

m
Add clamp function
m (Add formatNum from Module:Shared)
m (Add clamp function)
Line 34: Line 34:
end
end
end     
end     
--- Clamps a value between a minimum and maximum range.
-- @param value (number) The value to be clamped.
-- @param min (number) The minimum value in the range.
-- @param max (number) The maximum value in the range.
-- @return (number) The clamped value within the specified range.
function p.clamp(value, min, max)
    return math.min(math.max(value, min), max)
end


--- Parses a string representation of a number with suffixes
--- Parses a string representation of a number with suffixes
2,875

edits