我需要将一组图块从 C++ 传输到 Angelscript,我尝试添加一个返回 std::vector 的函数,但它返回此错误
Failed in call to function 'RegisterGlobalFunction' with 'array<DumbTile> GetTilesAt(int x, int y)' (Code: asINVALID_DECLARATION, -10)
我的代码:
std::vector<DumbTile> GetTilesAt(int x, int y) {
std::vector<DumbTile> output;
for (DumbTile t : tiles) {
if (t.x == x && t.y == y) {
output.push_back(t);
}
}
return output;
}
engine->RegisterGlobalFunction("array<DumbTile> GetTilesAt(int x, int y)", asFUNCTIONPR(GetTilesAt, (int, int), std::vector<DumbTile>), asCALL_CDECL);