🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to use not operator?

Started by
2 comments, last by SharkBait 19 years, 2 months ago
I'm having trouble using the logic 'not' operator. I tried looking up the docs and also had a quick look-around in the forum but I couldn't find any examples. I'm basically writing code as in the following: void myFunc() { bool b = false; if (!b) { // do something here } } The AS compiler fails on the (!) symbol saying that it is an unsupported operation for the datatype. I tried using "not" but to no avail. I am assuming here that (!) and (not) are equivalent tokens since (&&) and (||) and interchangable with (and) and (or) respectively. Am I doing something wrong? P.S. I'm using the stable version but I did not have the opportunity to try this out with an earlier stable or WIP version. Platform is Win32.
tIDE Tile Map Editorhttp://tide.codeplex.com
Advertisement
You've found a bug in the library. I'm looking in to it right now.

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 introduced when I added const for objects.

You can fix it by changing line 4537 in as_compiler.cpp, function CompileExpressionPreOp() to:

if( ctx->type.dataType.IsEqualExceptConst(asCDataType(ttBool, true, false)) )

instead of:

if( ctx->type.dataType == asCDataType(ttBool, true, false) )

Thanks for discovering this bug.

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

Uhmm.. sorry for being the bearer of bug news :)
Anyway, glad to have been of help.. and thanks for the super quick fix!
tIDE Tile Map Editorhttp://tide.codeplex.com

This topic is closed to new replies.

Advertisement