Jump to content
  • Advertisement
Sign in to follow this  

Changing the pointer of a class member

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

Alright say i have a class that looks like this: AngelScript
class Blah
{
  float x;
  float y;
}
Than i create an instance of it using CreateScriptObject() and i now want to change the pointer of the x and y to my own x and y. Like this: C++
float x, y;
(float*)instance->GetPropertyPointer(0) = &x
(float*)instance->GetPropertyPointer(1) = &y;
What happens to the x and y that angel script created in CreateScriptObject()? Does it get freed?

Share this post


Link to post
Share on other sites
Advertisement
GetPropertyPointer() returns a pointer to the property so that you can read it's value or overwrite it. It doesn't let you change the actual location of the property.

Share this post


Link to post
Share on other sites
Oh yeah. I was actually wondering how could that be possible until i looked at the examples of "GetReturnPointer()" and saw they were actually changing the value, not the pointer. It was the pointers to pointers that was confusing me.

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!