Jump to content
  • Advertisement
Sign in to follow this  
zexee

Internal value of bool?

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

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.

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites

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

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!