NumberRange

Overview

A data type representing a numeric range defined by two values. This range represents the span between a minimum and maximum value and is used to specify range limits in various numeric settings.

Internally, it uses 32-bit floating point format to store values, so precision may not be fully guaranteed when dealing with extremely large numbers or precise decimal calculations.

Constructors

new

Creates a new NumberRange based on the specified minimum and maximum values. When defining a range, the minimum value cannot exceed the maximum value, and if both values are identical, it represents a single-value range. You can clearly define a numeric range allowed.

Parameters

number InMin

Specifies the minimum value of the NumberRange. This value represents the start of the range and cannot be greater than the maximum value.

number InMax

Specifies the maximum value of the NumberRange. This value represents the end of the range and cannot be less than the minimum value.

Return

NumberRange

A NumberRange object created with the specified minimum and maximum value.

Code Samples

local NumRange = NumberRange.new(1, 10)

Properties

Min

number

It is the smallest number allowed in the NumberRange. To maintain range validity, this value cannot exceed the maximum value.

Code Samples

Max

number

It is the largest number allowed in the NumberRange. To maintain range validity, this value cannot be less than the minimum value.

Code Samples

Methods

Last updated