Sign in to follow this  

Creating an object in C++

This topic is 1112 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

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

This topic is 1112 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this