RegisterArray<CScriptAny*>("any[]", "any", engine);
...
class Point2D
{
Point2D(float pX, float pY)
{
mX=pX;
mY=pY;
}
float mX;
float mY;
}
void test()
{
any[] tAny;
for (int i=0; i<10; ++i)
{
Point2D tPoint(i*10.0f, 0.0f);
tAny.push_back(any(@tPoint));
}
for (int j=0; j<10; ++j)
{
Point2D @tPoint;
tAny[j].retrieve(@tPoint);
print(toString(tPoint.mX)+"\n");
}
}
🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Vector of any
Hi!
As I need a generic array in AngelScript my idea was to register the stl vector with any as type using CScriptAny and RegisterVector.
However this seems to work at the first moment but after a few tests my application sometimes crashed. When it didn't crash the print doesn't work as well.
Did someone similar things with CScriptAny or are there other solutions to this problem?
Verge
I believe you need to register the vector as:
RegisterArray<CScriptAny*>("any@[]", "any@", engine);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement