Bless you for using ipairs. I don’t think it should really be about potential nils but rather what you’re iterating over and understanding the difference between ipairs/pairs. ipairs should be used for arrays.
ipairs is designed to iterate over arrays, where the keys are numeric and incremental from 1 to the length of the table. Therefore, your iterations are occurring where your keys are known at [i+1]. It is also, compared to the old VM, significantly faster. A benchmark reading at RDC showed around 6.49 speedup.
pairs should be used in cases where you’re working with dictionaries, or otherwise where your keys are not known from the beginning and can be arbitrary. pairs calls next and gets the next element based on the last key.
Another thing: ipairs will iterate your elements in order. Order is not guaranteed nor known when it comes to pairs-based iteration. Even if you have numeric keys and you use pairs, it will not default to incremental iteration. There may be some cases where order is important!
