You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I'm new to SpiderMonkey. So far the learning experience has been great. I have played around it for about a week now.
I'm implementing a program in which I want to give the user a scripting ability. I have had some success in doing this. I was able to expose a C++ class in JavaScript and invoke its member functions.
I'm facing a challenge now. Maybe it's quite easy which I seem to be having trouble with. One of the member functions in my class return an std::map as in below.
std::map<std::string, std::string> &getKeyValues();
Now I want to allow my scripting authors below.
// JavaScript
var myKeyValues = my_instance.getKeyValues();
for(var key in myKeyValues) {
// do something with key and myKeyValues[key]
}
I have implemented a wrapper class for my C++ class. I have access to an instance of the original class inside the wrapper class thus I have the std::map in a variable.
My questions is how can pass this map back to JavaScript to accomplish the above.