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