Jump to content
  • Advertisement
Sign in to follow this  

What to use if I wan to send a negative value to a script function?

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

What the title says.... The manual mentions:


[color=#604020]int SetArgDWord([color=#604020]int arg, asDWORD value);
[color=#604020]int SetArgQWord([color=#604020]int arg, asQWORD value);
[color=#604020]int SetArgFloat([color=#604020]int arg, [color=#604020]float value);
[color=#604020]int SetArgDouble([color=#604020]int arg, [color=#604020]double value);
[color=#604020]int SetArgByte([color=#604020]int arg, asBYTE value);
[color=#604020]int SetArgWord([color=#604020]int arg, asWORD value);

But all values are of unsigned type! How can I send a "-1" to my script?

Thanks.

Carlos

Share this post


Link to post
Share on other sites
Advertisement
So the negative value is reinterpreted as an unsigned value, and then again when inside the script reinterpreted as a signed int, restoring the original value?

Share this post


Link to post
Share on other sites
Yes. The Byte, Word, DWord, and QWord versions are just to get the right size of the data. It doesn't matter whether the information is signed or not.

I would have used the DWord and QWord for float and doubles too, had it not been for the complications of transforming the values without changing the binary representation. I guess a reinterpret_cast would solve that, but I didn't want to force the application developer to go through that.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!