Clamp (Function) — Skript

Addon: Skript · Category: Function · Since: 2.8.0

Syntax

clamp(values: number, min: number, max: number) :: numbers

Description

Clamps one or more values between two numbers.

Examples

clamp(5, 0, 10) = 5
clamp(5.5, 0, 5) = 5
clamp(0.25, 0, 0.5) = 0.25
clamp(5, 7, 10) = 7
clamp((5, 0, 10, 9, 13), 7, 10) = (7, 7, 10, 9, 10)
set {_clamped::*} to clamp({_values::*}, 0, 10)

View source