Jump to content

C++/Python - map/dictionary


Recommended Posts

How can i convert c++ map to  python dictionary, for example

 

 

std::map<std::string, int> mymap;

mymap["key1"] = 50;
mymap["key2"] = 20;
mymap["key3"] = 100;

i want to reclaim in python,

self.mydictionary["key1"] = 50;
self.mydictionary["key2"] = 20;
self.mydictionary["key3"] = 100;

Is this possible with metin2 included libraries?

 

 

In worst case i would like to reclaim array as a list, not only get by loop.

Edited by Casawir
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Former Staff

I dont know if you can push maps to python, but i did it this way when i needed it:

1: Say python a new map is incoming, i named that one startListener

2: Give datasets one by one to python by Py_* commands and fill a new array you created / flushed in startListener with the data

3: Say python your have no more data, i named that one stopListener and execute whatever you want with the array

 

I don't have access to my source code right now. Sorry for just discribing it without code examples

Edited by .InyaProduction
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.