# Clamp (Integer)
Grammar — Clamp value between min and max
Flags —Function
Adjust the value to make sure it stays within the provided bounds.
# Arguments
int
— Valueint
— Minint
— Max
Returns — int
int libNtve_gf_ArithmeticIntClamp(
int lp_value,
int lp_min,
int lp_max,
);
# Related
Category: Math / Arithmetic
- [F] —
int
— Absolute Value (Integer) — ( AbsI ) - [F] —
fixed
— Absolute Value (Real) — ( AbsF ) - [F] —
int
— Arithmetic (Integer) — ( ) - [F] —
int
— Bitwise Arithmetic (Integer) — ( ) - [F] —
fixed
— Arithmetic (Real) — ( ) - [F] —
int
— Arithmetic Multiple (Integer) — ( ) - [F] —
int
— Bitwise Arithmetic Multiple (Integer) — ( ) - [F] —
fixed
— Arithmetic Multiple (Real) — ( ) - [F] —
int
— Ceiling (Integer) — ( CeilingI ) - [F] —
fixed
— Ceiling (Real) — ( Ceiling ) - [F] —
int
— Clamp (Integer) — ( libNtve_gf_ArithmeticIntClamp ) - [F] —
fixed
— Clamp (Real) — ( libNtve_gf_ArithmeticRealClamp ) - [F] —
void
— Cycle — ( ) - [F] —
int
— Floor (Integer) — ( FloorI ) - [F] —
fixed
— Floor (Real) — ( Floor ) - [F] —
int
— Log2 (Integer) — ( Log2I ) - [F] —
fixed
— Log2 (Real) — ( Log2 ) - [F] —
fixed
— Log (Real) — ( libNtve_gf_Log ) - [F] —
int
— Modulo (Integer) — ( ModI ) - [F] —
fixed
— Modulo (Real) — ( ModF ) - [F] —
int
— Power (Integer) — ( PowI ) - [F] —
fixed
— Power (Real) — ( Pow ) - [F] —
int
— Round (Integer) — ( RoundI ) - [F] —
fixed
— Round (Real) — ( Round ) - [F] —
int
— Pow2 (Integer) — ( Pow2I ) - [F] —
fixed
— Pow2 (Real) — ( Pow2 ) - [F] —
int
— Square Root (Integer) — ( SquareRootI ) - [F] —
fixed
— Square Root (Real) — ( SquareRoot ) - [F] —
int
— Trunc (Integer) — ( TruncI ) - [F] —
fixed
— Trunc (Real) — ( Trunc )
# Examples
# mods/heromods/alarak.stormmod
// L224
libNtve_gf_ArithmeticIntClamp(libHALA_gv_heroAlarakActiveDeadlyChargeCasters, 0, 10)
# mods/heromods/nexushunter.stormmod
// L269
libNtve_gf_ArithmeticIntClamp(libHNXH_gv_heroNexusHunterActiveFinalStrikeCasters, 0, 10)
# mods/starcoop/starcoop.sc2mod
// L6192
libNtve_gf_ArithmeticIntClamp(RoundI((UserDataGetFixed("CoopAbilityTychusRageBuffs", lp_rageBuff, "Rage Factor", 1) * UnitGetPropertyFixed(lp_tychusUnit, c_unitPropEnergy, c_unitPropCurrent))), UserDataGetInt("CoopAbilityTychusRageBuffs", lp_rageBuff, "Min Stacks", 1), UserDataGetInt("CoopAbilityTychusRageBuffs", lp_rageBuff, "Max Stacks", 1))
# mods/starcoop/starcoop.sc2mod
// L998
libNtve_gf_ArithmeticIntClamp(lp_index, 0, libCOOC_gv_cCC_PLAYERPRESTIGEMAXRANK)
# mods/starcoop/starcoop.sc2mod
// L1632
libNtve_gf_ArithmeticIntClamp(lp_index, 0, libCOOC_gv_cCC_PLAYERPRESTIGEMAXRANK)
# mods/warcoop/warcoopdata.sc2mod
// L1806
libNtve_gf_ArithmeticIntClamp(lp_numberofLoots, 0, libWCdr_gv_dEBUG_LOOT_AWARD_MAX_LOOT)
// L2490
libNtve_gf_ArithmeticIntClamp(lp_difficultyLevel, UserDataGetInt("LegionDifficultyScaling", lv_difficultylevelrangeinstance, "MinLevel", 1), UserDataGetInt("LegionDifficultyScaling", lv_difficultylevelrangeinstance, "MaxLevel", 1))
// L2633
libNtve_gf_ArithmeticIntClamp(PlayerGroupCount(libWCdr_gf_GetLegendPlayers()), lv_minlevel, lv_maxlevel)
// L3321
libNtve_gf_ArithmeticIntClamp(RoundI(libNtve_gf_DialogItemValue(libWCdr_gv_debugHeroSelectUI.lv_optionsPanel.lv_difficultySlider, 1)), UserDataGetInt("LegionDifficultyScaling", "LevelRange", "MinLevel", 1), UserDataGetInt("LegionDifficultyScaling", "LevelRange", "MaxLevel", 1))