Advertisement

enums

Started by September 08, 2014 05:47 AM
3 comments, last by PhilCK 10 years, 2 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
   };
}

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()
{
}
Advertisement

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