local tbl = {10,20,30,40,50}

local range = 25

How would I make a function to get the closest number to my "range"? Need this for a game. Any help is appreciated!