fivem-ts

a library to speed up the development of Fivem scripts and frameworks


Project maintained by Purpose-Dev Hosted on GitHub Pages — Theme by mattgraham

fivem-ts - Documentation v0.7.5Docs


fivem-ts - Documentation v0.7.5 / Shared / clamp

Function: clamp()

clamp(num, min, max): number

Clamps a number to a specified range.

Parameters

num: number

The number to clamp.

min: number

The minimum value.

max: number

The maximum value.

Returns

number

The clamped value.

Example

clamp(5, 1, 10); // 5
clamp(0, 1, 10); // 1
clamp(15, 1, 10); // 10

Defined in

shared/utils/FMath.ts:16