🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Creating an object in C++

Started by
1 comment, last by wilberolive 9 years, 7 months ago
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.
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

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

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.

This topic is closed to new replies.

Advertisement