Advertisement

Registering Types

Started by February 17, 2014 07:46 AM
0 comments, last by WitchLord 10 years, 9 months ago

Is it possible to register a new type for void, like this for example.


engine->RegisterTypedef( "vd", "void" );

What about for the const keyword, like this for example.


engine->RegisterTypedef( "cn", "const" );

These code snippets fail of course, I'm just showing them as examples of what I would like to do. I'm integrating with third party libraries that use other keywords for these things and it would be great if I could match the script code up to the c++ code used when working with these libraries.

No, it is not possible to register this.

You'd be best off doing a replacement of the tokens in a pre-processing pass. The CScriptBuilder add-on can easily be enhanced to do this replacement, as it already tokenizes the script in order to do some processing, it's just a matter of checking whether the tokens matches the ones that needs to be replaced and then modify the script before passing it to the script engine.

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