The index doesn’t mean anything here, because a map can be accessed in any order, that’s the whole point
If you were going to use a map, you would have something like mesh:material. Then you just run through the keys ( meshes ) and set the materials ( values ).