for i=10,20 do print(i, math.clamp(i,12,17)) end --[[ Output: 10 12 11 12 12 12 13 13 14 14 15 15 16 16 17 17 18 17 19 17 20 17 ]]