• Advertisement
Sign in to follow this  

Not operator

This topic is 3388 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

Hi there, i've upgraded to version 2.14.1 and noticed that the not (!) operator is no longer working in if statements. I always get "Expected expression value" errors. Is it just a config thing or has the parser changed? Thanks, Tim

Share this post


Link to post
Share on other sites
Advertisement
A simple example is the following:


class Test
{
bool isTrue() { return true; }

void test()
{
if ( !isTrue() )
print("false");
else
print("true");
}
}

Test t;



I can rewrite the if statement to get it working:

class Test
{
bool isTrue() { return true; }

void test()
{
if ( isTrue() != true )
print("false");
else
print("true");
}
}

Test t;



Regards,
Tim


Share this post


Link to post
Share on other sites
Yeah that works too, but !isTrue() worked at least in version 2.13.1.
I don't know why there should be extra parenthesis necessary now.

Regards,
Tim

Share this post


Link to post
Share on other sites
I am not sure why. It is perhaps some ANSI requirement. BTW you don't specify which tool you are talking about (version 2.13.1 of what?) and the language you are using. Probably C++ ?

Share this post


Link to post
Share on other sites
Quote:
Original post by VinzO
BTW you don't specify which tool you are talking about (version 2.13.1 of what?) and the language you are using. Probably C++ ?

Give that this is the AngelCode forum, you can assume the language is AngelScript.

Share this post


Link to post
Share on other sites
Sure, sorry. I got here by clicking on
"recent threads" on the homepage. Haven't seen the forum title.

Share this post


Link to post
Share on other sites
This bug was caused by the introduction of the !is operator. The tokenizer is incorrectly parsing the "!" "isTrue" tokens as "!is" "True", which causes the error you're seeing.

I'll have a fix for it soon.

Share this post


Link to post
Share on other sites
:) Very funny bug and what a coincidence that all my script bool functions are called isXXX()

Thanks for fixing,
Tim

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement