enums

Started by
3 comments, last by PhilCK 9 years, 7 months ago

I'm sure this is me being silly but I can't make an enum in AS.

I get this.


AS Error: ShipView (29, 3) Expected expression value
AS Error: ShipView (29, 3) Instead found 'enum'

For this.


void Baz()
{
   enum Foo
   {
      BAR
   };
}

Advertisement

I don't know whether AngelScript intends to support enums within function scope, but today it doesn't. Put your enum outside the function scope and it'll work.


enum Foo
{
   BAR
};


void Baz()
{
}

Ah right, I had tried in class scope but now see that it needs to be global.

Thanks.

I plan on eventually adding support for declaring types as members of classes, e.g. enums and funcdefs. However this is currently not on the top of my priority list.

Declaring types locally in functions is probably not going to happen, unless someone comes up with a very strong argument for this need.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thanks. I only use enum's locally to index array's, no big need here :), although class level could would be useful, again I have no strong need.

This topic is closed to new replies.

Advertisement