Is DumbTile
registered before GetTilesAt()
registration?
Is array<T>
registered before GetTilesAt()
registration?
Both needs to be registered before you can register your function.
Are you using stock array implementation (sdk/add_on/scriptarray/
) or your own, std::vector<>
-based implementation? When using stock addon, application must convert std::vector
to CScriptArray
first, as angelscript can't really do that on its own due to way how arrays works.
There is obvious alternative - switch from using std::vector
to CScriptArray
everywhere where you want scripts to access data, but this might be annoying.
Example std::vector<Object*> <-> CScriptArray*
conversion
template<typename Type>
void AppendVectorToArrayRef( vector<Type>& vec, CScriptArray* arr )
{
if( !vec.empty() && arr )
{
uint i = (uint)arr->GetSize();
arr->Resize( (asUINT)(i + (uint)vec.size() ) );
for( uint k = 0, l = (uint)vec.size(); k < l; k++, i++ )
{
Type* p = (Type*)arr->At( i );
*p = vec[k];
(*p)->AddRef();
}
}
}
template<typename Type>
void AssignScriptArrayInVector( vector<Type>& vec, CScriptArray* arr )
{
if( arr )
{
uint count = (uint)arr->GetSize();
if( count )
{
vec.resize( count );
for( uint i = 0; i < count; i++ )
{
Type* p = (Type*)arr->At( i );
vec[i] = *p;
}
}
}
}
Code is bit old but i think it should still work, even if it begs for some refresh.