Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ulty | |
Old Version | Published before Godot 3 was released. |
I want to go through a large dictionary of rooms.
The key value pair is Vector2() and a pointer to the room for each element.
This would be my first approach but I don’t think that this would scale very well for a 1000+ room dictionary.
for i in rooms_dic.keys():
var room = rooms_dic[i]
is there a way to get a array of the elements of a dictionary directly ?
Maybe you could have two representations of the container:
One to quickly iterate over all rooms (array), and another to quickly get a room from its position (dict).
Then you could maintain the two containers within a “room manager” or whatever class is in control of the rooms.
Zylann | 2016-04-10 19:54
Probably the way I will implement it, but I was hoping that there was an easier (lazier) way to do it.
ulty | 2016-04-10 20:05
I’m assuming what Zylann said actually might be an answer, this is the way how I’m doing this thing as well.
kubecz3k | 2016-04-11 15:24