Return a pointer to the array element. Returns 0 if the index is out of bounds
| 889 | |
| 890 | // Return a pointer to the array element. Returns 0 if the index is out of bounds |
| 891 | const void *CScriptArray::At(asUINT index) const |
| 892 | { |
| 893 | if( buffer == 0 || index >= buffer->numElements ) |
| 894 | { |
| 895 | // If this is called from a script we raise a script exception |
| 896 | asIScriptContext *ctx = asGetActiveContext(); |
| 897 | if( ctx ) |
| 898 | ctx->SetException("Index out of bounds"); |
| 899 | return 0; |
| 900 | } |
| 901 | |
| 902 | if( (subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE) ) |
| 903 | return *(void**)(buffer->data + elementSize*index); |
| 904 | else |
| 905 | return buffer->data + elementSize*index; |
| 906 | } |
| 907 | void *CScriptArray::At(asUINT index) |
| 908 | { |
| 909 | return const_cast<void*>(const_cast<const CScriptArray *>(this)->At(index)); |
no test coverage detected