Jump to content
  • Advertisement
Sign in to follow this  
wilberolive

Creating an object in C++

This topic is 1333 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm just wondering if it is possible to actually create an asIScriptObject in C++ and add member variables to it.

I know I can create an AS class and use it to create an asIScriptObject, but what I'd really like to be able to do is parse an xml file of name and type pairs and then build an asIScriptObject from it.

For example if the xml had <testMember>int</testMember> in it, then I would like to create an asIScriptObject instance and then do something like testObject->addMember("testMember", "int").

The idea is that latter on I can pass these dynamic asIScriptObjects to AS scripts to be operated on.

Share this post


Link to post
Share on other sites
Advertisement

It cannot be done the way you describe it, but you could parse the XML file and generate a script class declaration from it and then build that as a script in order to create the asIScriptObject. It can be compiled in a separate module so you don't have to rebuild the module where your real script is running, if you don't want to.

 

Regards,

Andreas

Share this post


Link to post
Share on other sites
Hey thanks for the reply. I actually thought of the same thing you suggested too. I just wanted to check if there was another way of doing it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!