Return a pointer to the array element. Returns 0 if the index is out of bounds
| 950 | |
| 951 | // Return a pointer to the array element. Returns 0 if the index is out of bounds |
| 952 | const void *CScriptArray::At(asUINT index) const |
| 953 | { |
| 954 | if( buffer == 0 || index >= buffer->numElements ) |
| 955 | { |
| 956 | // If this is called from a script we raise a script exception |
| 957 | asIScriptContext *ctx = asGetActiveContext(); |
| 958 | if( ctx ) |
| 959 | ctx->SetException("Index out of bounds"); |
| 960 | return 0; |
| 961 | } |
| 962 | |
| 963 | if( (subTypeId & asTYPEID_MASK_OBJECT) && !(subTypeId & asTYPEID_OBJHANDLE) ) |
| 964 | return *(void**)(buffer->data + elementSize*index); |
| 965 | else |
| 966 | return buffer->data + elementSize*index; |
| 967 | } |
| 968 | void *CScriptArray::At(asUINT index) |
| 969 | { |
| 970 | return const_cast<void*>(const_cast<const CScriptArray *>(this)->At(index)); |
no test coverage detected