# Clamp (Integer)

Grammar — Clamp value between min and max
FlagsFunction

Adjust the value to make sure it stays within the provided bounds.

# Arguments

  • int — Value
  • int — Min
  • int — Max

Returns — int

int libNtve_gf_ArithmeticIntClamp(
	int lp_value,
	int lp_min,
	int lp_max,
);

Category: Math / Arithmetic

# Examples

# mods/heromods/alarak.stormmod

LibHALA.galaxy

// L224
libNtve_gf_ArithmeticIntClamp(libHALA_gv_heroAlarakActiveDeadlyChargeCasters, 0, 10)

# mods/heromods/nexushunter.stormmod

LibHNXH.galaxy

// L269
libNtve_gf_ArithmeticIntClamp(libHNXH_gv_heroNexusHunterActiveFinalStrikeCasters, 0, 10)

# mods/starcoop/starcoop.sc2mod

LibCOMI.galaxy

// L6166
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

LibCOOC.galaxy

// L998
libNtve_gf_ArithmeticIntClamp(lp_index, 0, libCOOC_gv_cCC_PLAYERPRESTIGEMAXRANK)

# mods/starcoop/starcoop.sc2mod

LibCOUI.galaxy

// L1632
libNtve_gf_ArithmeticIntClamp(lp_index, 0, libCOOC_gv_cCC_PLAYERPRESTIGEMAXRANK)

# mods/warcoop/warcoopdata.sc2mod

WarCoopData.galaxy

// 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))