How to use not operator?
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
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement