Sign in to follow this  
PhilCK

enums

Recommended Posts

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
   };
}

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this