🎉 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!
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement