Should be:
local nLowestDist = min(topDist, midDist, botDist)