as many mods around, to delete some unwanted items from a list, I often use table.remove inside an iterative pairs-loop.
ex :
Code: Select all
for i, entity in pairs(entities) do
	if not(entity and entity.valid) then
		table.remove(entities,i)
	end
end
http://stackoverflow.com/questions/1239 ... -iterating
Any idea or precision on this ? Why modders do not seem to care about this problem ?







 I had a major factorio crash because doing it this way while cleaning unvalid entities in on-config-changed event after a mod uninstall.
   I had a major factorio crash because doing it this way while cleaning unvalid entities in on-config-changed event after a mod uninstall.
