Jump to content
  • Advertisement
Sign in to follow this  
saejox

any addon usage with = operator

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

Hi,

is it possible to modify any addon to work with = operator?


float f = 24.0f;
any Var = f;
float v2 = Var;
int a = 5;
any Var2 = Var;
Var = a; // show error, not compile error. runtime message


it works just like auto in c++.
.store and .receive are confusing to use.

i like modify it but i am limited by my knowledge of angelscript.
is this doable?

Thanks. Edited by saejox

Share this post


Link to post
Share on other sites
Advertisement
You can register the various overrides for the opAssign methods to allow the assignment of values to the any type.

To allow the any type to be assigned to a primitive type you'll have to register the asBEHAVE_IMPLICIT_VALUE behaviour.

The opAssign can raise a script exception when it detects an invalid assignment. This would be done by getting the active context with asGetActiveContext(), then calling SetScriptException() on it.

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.

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

Sign me up!