how use the enum of class by angelscript ?

Recommended Posts

zopenge    122
Class A { enum _CODE { _CODE_NONE, _CODE_ONE } }; how can i register this by angelscript ? Thanks so much ! :)

Share on other sites
WitchLord    4678
Currently you can only do this by declaring constants in the script, e.g.:

const char *scriptConstants = "const int _CODE_NONE = 0; const int _CODE_ONE = 1;";engine->AddScriptSection(module, "constants", scriptConstants, strlen(scriptConstants));// Add the normal script section to the same module, then build it

However, as of the next release AngelScript will support true enums. Digital_Asphyxia already sent me the code that implements this support, I just have to include it in the library. Hopefully, by the end of the week, the WIP version in SVN will already have the support.

Regards,
Andreas

Share on other sites
zopenge    122

That's a good news for angelscript ~~ I hope we can use the real enum for the next version ~~ thanks for your work ~ I really like AS :)

Share on other sites
WitchLord    4678
I added preliminary support for enum to the WIP version in SVN now. I'll be doing some more modifications to it, but I'd be grateful for any additional testing I can get before I release the next version.

Create an account

Register a new account