Extending an Angelscript implementation

Started by
2 comments, last by WitchLord 15 years, 3 months ago
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?
Advertisement
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.

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

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.
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).

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

This topic is closed to new replies.

Advertisement