Advertisement

any addon usage with = operator

Started by July 12, 2012 12:19 AM
0 comments, last by WitchLord 12 years, 5 months ago
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.
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

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement