🎉 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!

Registering Types

Started by
0 comments, last by WitchLord 10 years, 4 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.

Advertisement

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