• Advertisement
Sign in to follow this  

enums

This topic is 1257 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Share this post


Link to post
Share on other sites

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

 

Thanks.

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
Sign in to follow this  

  • Advertisement