Skip to content

Range

Represents a range of possible integers by providing a minimum and maximum.

Serialization can error

If the number serialized is outside the range provided, serialization will error. If you instead want to clamp the input/output, use datatypes.clamp()

function light.datatypes.range

Shared Synchronous
1
2
3
4
function range(
    minimum: number,
    maximum: number
): (Datatype<number>)

Size

Will use the minimum number of bytes possible to represent the range of possible numbers:

math.abs(maximum - minimum) < n Size
n = 256 1 Byte
n = 65,536 2 Bytes
n = 16,777,216 3 Bytes
n = 4,294,967,296 4 Bytes
n = 2 ^ 40 5 Bytes
n = 2 ^ 48 6 Bytes
n = 2 ^ 56 7 Bytes