Sign in to follow this  
Maega

Extending an Angelscript implementation

Recommended Posts

Hello, Let's say I have a program that I have implemented Angelscript in. I have bound to a C++ class in my application. Let's say another user wants to extend that C++ class by loading a plugin. This plugin gets passed the Angelscript scriptengine object. If that user were to use that object, could they bind their own C++ class methods into the existing class in the original program or is that not going to work as expected? What are my options?

Share this post


Link to post
Share on other sites
Plugins are able to register their own extensions with the engine. The application just needs to pass the engine pointer to the plugin. Whether you need to use wrapper functions or not to bind these extensions, depends on how exactly you're implementing the extensions.

Share this post


Link to post
Share on other sites
My intention is to have those plugins extend the class I already have registered.

The new functions would look like they were members of the registered object. This is so no one has to remember what function belongs to what object and what objects they must use in their script.

For the most part, the new functions wouldn't need to know anything about the registered class data-wise. They would act more like standalone extensions, if that even makes sense.

Share this post


Link to post
Share on other sites
AngelScript doesn't prevent additions to the registered classes, so you shouldn't have any trouble registering more class methods from the plug-ins.

If you want to be able to unload the plug-ins while still keeping the script engine in memory, you may want to look into the configuration groups (see asIScriptEngine::BeginConfigGroup in the manual).

Share this post


Link to post
Share on other sites

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