Jump to content

[SOLVED] How can I find the key by the index with a map container?


photo

Recommended Posts

I am using the Unigine 1.0. I found a function "key(int id)" in DOCs. But when I use this function to get a key of a map container, the engine will show me the interpreter's error message that the interpreter cannot find the "key(id)" function. So I do not know how I can find the key by using the index of a map container.

Link to comment

Hi TingWu,

 

You mean this code isn't working?

int map[] = ( 1:2, 2:3, 3:4 );
forloop(int i = 0; map.size()) {         
   int key = map.key(i);         
   log.message("%d: %d\n",i,map[key]);     
}
Link to comment
×
×
  • Create New...