Jump to content
  • Advertisement
Sign in to follow this  
cvet

Register handle as reference

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

Hello.

In some cases need to register handle, but disable possibility to null it (e.g. like reference or value type).

Possible to add registering properties with this behaviour? Like this:

ScriptString* str = ScriptString::GetFromPool(); // Class can't be allocated on stack

Engine->RegisterGlobalProperty( "string& str", &str ); // Here i want register like handle, but protect from nulling it

Same for RegisterObjectProperty where need type class offset, not pointer.

Share this post


Link to post
Share on other sites
Advertisement

You can register the global property like this:

 

ScriptString* str = ScriptString::GetFromPool();
Engine->RegisterGlobalProperty("string str", str);

 

For class members it is a bit more tricky. In this case it is currently only possible by using virtual properties (i.e. a couple of get/set functions).

 

I'll look into adding support for & when registering properties to indicate that the property needs to be de-referenced when accessed.

Share this post


Link to post
Share on other sites

I've finally added support for registering class members as references, e.g.

 

engine->RegisterObjectProperty("type", "complex &cmplx", asOFFSET(type, cmplx));

 

This is available in revision 2142.

 

Regards,

Andreas

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!