Unlike standard lua factorios built-in lua interpreter guarantees deterministic order of pairs(), so there's no real reason to use ipairs. If you need performance a for i=1,x loop is faster. And if you don't know if something is sparse or not you just print it with print(serpent.block(x)) and have a look at it :p.