ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:clamp

This is an old revision of the document!


Table of Contents

clamp

num clamp(num x, num a, num b)

Description

Limits x to the range [a; b]. If x falls in the range, returns x.

If x is less than a, returns a.

If x is greater than b, returns b.

Examples

clamp(7, 6, 8) -> 7;
clamp(5, 6, 8) -> 6;
clamp(8, 6, 8) -> 8;

clamp(0.25, 0.2, 0.3) -> 0.25;
clamp(0.15, 0.2, 0.3) -> 0.2;
clamp(0.35, 0.2, 0.3) -> 0.3;
functions/clamp.1489566378.txt.gz · Last modified: 2017/03/15 10:26 by korshun