ipairs is best but it needs to be an array without gaps.
pairs must be used for dictionaries or arrays with gaps.
The only “error” you could have with pairs is that the order is not guaranteed. With ipairs it goes through the array in order, hence needing to be an array with no gaps.