cast from one to another
i looked through documentation, bub didn't find many info about cast operator i wanna use it like this(if that's possible) float p=236.3f; int k=900; string mne="test12"; string st=(string)p+(string)mne+(string)"test"+(string)k; is there a way to do this in angelscript?[if so, does any docs about that exists and can u point me to them] and happy new year(that will happen soon)!
Crazy dude smoking D3D11, AngelScript, PhysX, 3D Sound, Network, DB, FBX, and some other weird things, doing that on Visual Studio 2010 + Visual Assist X on Overclocked CPU
The casting in AngelScript is done with the constructor syntax, not the syntax used in C.
Currently the script you wrote would have to be written as following:
Though, for the sample you gave us, there would actually not be any need for the casting at all if the string type has the appropriate opAdd methods. The script could be written like this:
Here's some references to the manual for further reading:
Please let me know if you have further doubts.
A Happy New Year to you too.
Regards,
Andreas
Currently the script you wrote would have to be written as following:
float p = 236.3f;int k = 900;string mne = "test12";string st = string(p) + string(mne) + string("test") + string(k);
Though, for the sample you gave us, there would actually not be any need for the casting at all if the string type has the appropriate opAdd methods. The script could be written like this:
string st = p + mne + "test" + k;
Here's some references to the manual for further reading:
- Language syntax for type conversions
- The value cast behaviour to convert object to primitive
- Registering class hierarchies and the reference cast behaviour
Please let me know if you have further doubts.
A Happy New Year to you too.
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
Popular Topics
Advertisement
Recommended Tutorials
Advertisement