Now I have another problem. I have a pointer to a array of structs, and I need it accessible by index in Angelscript, like: `sprite[num].member`
Here's what I have. Obviously, this doesn't work, and the documentation is completely opaque in this regard, not providing any examples, and I can't find the information I need.
sprite
is defined as uspritetype *sprite;
in engine, which points towards this static array: uspritetype sprite_s[16384];
If you're wondering why it's set up like that instead of accessing sprite_s directly, is because sometimes the pointer needs to be changed to other related static arrays for various reasons.
asEngine->RegisterObjectType("sprite_t", sizeof(uspritetype), asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<uspritetype>());
asEngine->RegisterObjectProperty("sprite_t", "int32_t x", asOFFSET(uspritetype, x));
asEngine->RegisterObjectProperty("sprite_t", "int32_t y", asOFFSET(uspritetype, y));
asEngine->RegisterObjectProperty("sprite_t", "int32_t z", asOFFSET(uspritetype, z));
asEngine->RegisterObjectProperty("sprite_t", "vec2_t xy", asOFFSET(uspritetype, xy));
asEngine->RegisterObjectProperty("sprite_t", "vec3_t xyz", asOFFSET(uspritetype, xyz));
asEngine->RegisterObjectProperty("sprite_t", "uint16_t cstat", asOFFSET(uspritetype, cstat));
asEngine->RegisterObjectProperty("sprite_t", "int16_t picnum", asOFFSET(uspritetype, picnum));
asEngine->RegisterObjectProperty("sprite_t", "int8_t shade", asOFFSET(uspritetype, shade));
asEngine->RegisterObjectProperty("sprite_t", "uint8_t pal", asOFFSET(uspritetype, pal));
asEngine->RegisterObjectProperty("sprite_t", "uint8_t clipdist", asOFFSET(uspritetype, clipdist));
asEngine->RegisterObjectProperty("sprite_t", "uint8_t blend", asOFFSET(uspritetype, blend));
asEngine->RegisterObjectProperty("sprite_t", "uint8_t xrepeat", asOFFSET(uspritetype, xrepeat));
asEngine->RegisterObjectProperty("sprite_t", "uint8_t yrepeat", asOFFSET(uspritetype, yrepeat));
asEngine->RegisterObjectProperty("sprite_t", "int8_t xoffset", asOFFSET(uspritetype, xoffset));
asEngine->RegisterObjectProperty("sprite_t", "int8_t yoffset", asOFFSET(uspritetype, yoffset));
asEngine->RegisterObjectProperty("sprite_t", "int16_t sectnum", asOFFSET(uspritetype, sectnum));
asEngine->RegisterObjectProperty("sprite_t", "int16_t statnum", asOFFSET(uspritetype, statnum));
asEngine->RegisterObjectProperty("sprite_t", "int16_t ang", asOFFSET(uspritetype, ang));
asEngine->RegisterObjectProperty("sprite_t", "int16_t owner", asOFFSET(uspritetype, owner));
asEngine->RegisterObjectProperty("sprite_t", "int16_t xvel", asOFFSET(uspritetype, xvel));
asEngine->RegisterObjectProperty("sprite_t", "int16_t yvel", asOFFSET(uspritetype, yvel));
asEngine->RegisterObjectProperty("sprite_t", "int16_t zvel", asOFFSET(uspritetype, zvel));
asEngine->RegisterObjectProperty("sprite_t", "vec3_16_t vel", asOFFSET(uspritetype, vel));
asEngine->RegisterObjectProperty("sprite_t", "int16_t lotag", asOFFSET(uspritetype, lotag));
asEngine->RegisterObjectProperty("sprite_t", "int16_t hitag", asOFFSET(uspritetype, hitag));
asEngine->RegisterObjectProperty("sprite_t", "int16_t extra", asOFFSET(uspritetype, extra));
asEngine->RegisterGlobalProperty("sprite_t @sprite", &sprite);