Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Internal value of bool?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 zexee   Members   -  Reputation: 118

Like
0Likes
Like

Posted 04 October 2013 - 08:51 AM

I am just met trouble of use c++ to access bool value in angelscript. There is no SetArgBool or GetReturnBool, and it said bool is 8bit in the document. So I used *(bool*)GetAddressOfReturnValue() but it turned out wrong.

 

I looked at the memory, it seemed that true is 0 and false is 255 in byte. If so, that is different from c++ tradition (as far as I can remember, in c++ 0 is false and all others are true), and it should be documented or provide set and get function.



Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3292

Like
0Likes
Like

Posted 04 October 2013 - 10:27 AM

bool in AngelScript uses the same binary value as in C++. 0 for false and 1 for true (though anything different than 0 will be interpreted as true).

 

 

*(bool*)GetAddressOfReturnValue() should work, as should GetReturnByte().

 

 

What does the script function look like? And did the Execute() method return asEXECUTION_FINISHED? If it didn't return with this value the script function didn't return yet (or an exception was raised) and obviously any return value you try to get will not be what you expect.


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

#3 zexee   Members   -  Reputation: 118

Like
0Likes
Like

Posted 04 October 2013 - 06:08 PM

Sorry, it was my mistake. I was actually calling opCmp so equal is 0. Thank you for your answering!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS