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");
}
}
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);
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