bug with switch
in the app: r = pEngine->RegisterGlobalProperty("const int FIELDTYPE_ENUMERATION",&asCHelper::FIELDTYPE_ENUMERATION); in the script: switch(xxx) { case FIELDTYPE_ENUMERATION: .... } Error: case expression must be constant. Is that a bug ?
No, it's not a bug. The registered FIELDTYPE_ENUMERATION property is not considered a constant (although it is considered read-only from the script side).
You need to declare the const variable in the script for the compiler to consider is a valid constant in a switch case. E.g:
I'll improve this in the future of course.
Regards,
Andreas
You need to declare the const variable in the script for the compiler to consider is a valid constant in a switch case. E.g:
const char *cnst = "const int FIELDTYPE_ENUMERATION = 1;";pEngine->AddScriptSection(0, cnst, strlen(cnst));... add the other script sectionspEngine->Build(0);
I'll improve this in the future of course.
Regards,
Andreas
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
Popular Topics
Advertisement
Recommended Tutorials
Advertisement