Original Post
Why doesn't it work on AngelScript: But this one does: I get these error messages:
EntityArray array;
// ... filling the array etc.
@array[n] = DeleteEntity(array[n]);
EntityArray array; // an array of Entity handles
// ... filling the array etc.
Entity @temp = array[n];
@array[n] = DeleteEntity(temp);
AngelScript ERROR (line: 76):
No default constructor for object of type 'Entity'.
AngelScript ERROR (line: 76):
There is no copy operator for this type available. Entity is a reference counted reference object and everything works fine when I create a temporary handle. EntityArray is a std::vector wrapper with overloaded index operators. The only time the array doesn't work is when I pass any element as a function parameter.
r = pASEngine->RegisterObjectBehaviour("EntityArray",
asBEHAVE_INDEX, "Entity@ &f(const uint)",
asMETHODPR(EntityArray, operator[], (const unsigned int), Entity* &),
asCALL_THISCALL); assert( r >= 0 );
r = pASEngine->RegisterObjectBehaviour("EntityArray",
asBEHAVE_INDEX, "const Entity@ &f(const uint) const",
asMETHODPR(EntityArray, operator[], (const unsigned int) const, const Entity* &),
asCALL_THISCALL); assert( r >= 0 );