MeleeGetNearestValueWithin

Parameters
val real
minVal real
maxVal real
comment

It's the typical math.clamp. Returns val if it's within the bounds, else min/maxVal.

minVal must be less than or equal <= maxVal

return type
real
Source code
function MeleeGetNearestValueWithin takes real val, real minVal, real maxVal returns real
    if (val < minVal) then
        return minVal
    elseif (val > maxVal) then
        return maxVal
    else
        return val
    endif
endfunction
Source
Blizzard.j
wc3modding.com
MeleeGetNearestValueWithin