I’m assuming your grids are all exactly the same size, and are arranged in a perfect rectangle, as indicated by your image. How about storing all grids in a simple 2D array? You can then find the index of any grid by doing
grid_size = 30;
index_x = math.floor(user.x/grid_size);
index_y = math.floor(user.y/grid_size);
4
solved What is better way represent a spatial data