I'm using AS 2.24.0. I have a class like this:
[source]
class foo
{
public:
enum class state : int { a = 0, b, c };
};
[/source]
I want to register that in AngelScript. I have registration code like this:
[source]
Engine->RegisterObjectType("foo", sizeof(foo), asOBJ_REF | asOBJ_NOCOUNT);
//
Engine->RegisterEnum("foo::state");
Engine->RegisterEnumValue("foo::state", "stopped", static_cast<int>(foo::state::a));
Engine->RegisterEnumValue("foo::state", "playing", static_cast<int>(foo::state::b));
Engine->RegisterEnumValue("foo::state", "paused", static_cast<int>(foo::state::c));
[/source]
However, I seem to be getting errors due to the following piece of AS code in asCScriptEngine::ResgisterEnum:
[source]
// Make sure the name is not a reserved keyword
size_t tokenLen;
int token = tok.GetToken(name, strlen(name), &tokenLen);
if( token != ttIdentifier || strlen(name) != tokenLen )
return ConfigError(asINVALID_NAME, "RegisterEnum", name, 0);
[/source]
What am I doing wrong here?