BIS fnc clamp: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^<]*) *<\/code>" to "<code>$1$2$3</code>")
m (Text replacement - "<code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^<]*) *<\/code>" to "<code>$1$2$3</code>")
Line 17: Line 17:


|x1= <code>[5, 0, 10] call BIS_fnc_clamp; {{cc|returns 5}}
|x1= <code>[5, 0, 10] call BIS_fnc_clamp; {{cc|returns 5}}
  [0, 0, 10] call [[BIS_fnc_clamp]]; {{cc|returns 0}}
  [0, 0, 10] call BIS_fnc_clamp; {{cc|returns 0}}
[10, 0, 10] [[call]] [[BIS_fnc_clamp]]; {{cc|returns 10}}
[10, 0, 10] [[call]] [[BIS_fnc_clamp]]; {{cc|returns 10}}
[-5, 0, 10] [[call]] [[BIS_fnc_clamp]]; {{cc|returns 0}}
[-5, 0, 10] [[call]] [[BIS_fnc_clamp]]; {{cc|returns 0}}

Revision as of 21:38, 12 July 2022

Hover & click on the images for description

Description

Description:
Clamps provided value within min..max range.
Execution:
call
Groups:
Math

Syntax

Syntax:
[value, min, max] call BIS_fnc_clamp
Parameters:
value: Number - value to be clamped
min: Number - (Optional, default 0) lower limit
max: Number - (Optional, default 0) upper limit
Return Value:
Number - the clamped value

Examples

Example 1:
[5, 0, 10] call BIS_fnc_clamp; // returns 5 [0, 0, 10] call BIS_fnc_clamp; // returns 0 [10, 0, 10] call BIS_fnc_clamp; // returns 10 [-5, 0, 10] call BIS_fnc_clamp; // returns 0 [15, 0, 10] call BIS_fnc_clamp; // returns 10 [5, 10, 3] call BIS_fnc_clamp; // returns 10

Additional Information

See also:
See also needed

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note