Math
---@module[]
LGF.mathThe LGF.math module provides utility functions for mathematical operations in Lua. Below is a description of each available function.
Find Minimum Value
---@param ... number
---@return number|nil, string|nil
LGF.math:findMin(...)Parameters
... (number): A variable number of numerical arguments.
Returns
number|nil: The minimum value from the provided numbers, or nil if no arguments are provided.string|nil: An error message if no arguments are provided.
Examples
local minValue = LGF.math:findMin(10, 5, 8, 12)
print(minValue) -- Output: 5Find Maximum Value
---@param ... number
---@return number|nil, string|nil
LGF.math:findMax(...)Parameters
... (number): A variable number of numerical arguments.
Returns
number|nil:The maximum value from the provided numbers, or nil if no arguments are provided.string|nil:An error message if no arguments are provided.
Examples
local maxValue = LGF.math:findMax(10, 5, 8, 12)
print(maxValue) -- Output: 12Round Value
---@param value number
---@param decimalPlaces number|nil
---@return number
LGF.math:round(value, decimalPlaces)Parameters
value (number): The number to be rounded.decimalPlaces (number|nil): The number of decimal places to round to. Defaults to 0 if not provided.
Returns
(number):: The rounded value.
Examples
local roundedValue = LGF.math:round(23.4234324324)
print(roundedValue) -- Output: 23With Decimal Places
local roundedValue = LGF.math:round(23.4234324324, 4)
print(roundedValue) -- Output: 23.4234