Not operator

Started by
10 comments, last by WitchLord 15 years, 5 months ago
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
Advertisement
The not operator should still be working. Can you give me an example of where it doesn't work?

Regards,
Andreas

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

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


This should work
if ( !( isTrue() ) )
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
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++ ?
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.
Sure, sorry. I got here by clicking on
"recent threads" on the homepage. Haven't seen the forum title.
This must be a bug that made it into the latest release. I'll have fixed a.s.a.p.

Thanks for letting me know.

Regards,
Andreas

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

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.

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

This topic is closed to new replies.

Advertisement