Advertisement

cast from one to another

Started by December 31, 2009 01:44 AM
1 comment, last by e3d_ALiVE 15 years, 2 months ago
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:

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:


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

Advertisement
once again, thank you so much for ur replies!
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

This topic is closed to new replies.

Advertisement