Jump to content

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
https://metin2.dev/topic/8363-cpython-mapdictionary/
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
https://metin2.dev/topic/8363-cpython-mapdictionary/#findComment-51630
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.