BIS fnc clamp: Difference between revisions
Jump to navigation
Jump to search
m (infobox to template) |
Lou Montana (talk | contribs) (Page filling) |
||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
| arma3 | |game1= arma3 | ||
|1.00 | |version1= 1.00 | ||
|descr= Clamps provided value within min..max range. | |||
|s1= [value, min, max] call [[BIS_fnc_clamp]] | |||
| | |p1= value: [[Number]] - value to be clamped | ||
|p2= min: [[Number]] - (Optional, default 0) lower limit | |||
|p3= max: [[Number]] - (Optional, default 0) upper limit | |||
| | | [[Number]] - the clamped value | ||
| | |x1= <code> [5, 0, 10] [[call]] [[BIS_fnc_clamp]]; {{cc|returns 5}} | ||
[0, 0, 10] [[call]] [[BIS_fnc_clamp]]; {{cc|returns 0}} | |||
[10, 0, 10] [[call]] [[BIS_fnc_clamp]]; {{cc|returns 10}} | |||
[-5, 0, 10] [[call]] [[BIS_fnc_clamp]]; {{cc|returns 0}} | |||
[15, 0, 10] [[call]] [[BIS_fnc_clamp]]; {{cc|returns 10}} | |||
| | [5, '''10''', 3] [[call]] [[BIS_fnc_clamp]]; {{cc|returns 10}} | ||
</code> | |||
| | |seealso= [[:Category:Function Group: Math]] [[:Category:Command Group: Math]] | ||
}} | |||
[[Category:Functions|{{uc:clamp}}]] | |||
[[Category:Function Group: Math|{{uc:clamp}}]] | [[Category:Function Group: Math|{{uc:clamp}}]] | ||
[[Category: | [[Category:{{arma3}}: Functions|{{uc:clamp}}]] | ||
Revision as of 22:09, 2 January 2020
Description
- Description:
- Clamps provided value within min..max range.
- Execution:
- call
- Groups:
- Uncategorised
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:
- Return value needed
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
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