MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / At

Method At

src/server/angelscript/add_on/scriptarray/scriptarray.cpp:891–906  ·  view source on GitHub ↗

Return a pointer to the array element. Returns 0 if the index is out of bounds

Source from the content-addressed store, hash-verified

889
890// Return a pointer to the array element. Returns 0 if the index is out of bounds
891const 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}
907void *CScriptArray::At(asUINT index)
908{
909 return const_cast<void*>(const_cast<const CScriptArray *>(this)->At(index));

Callers 3

InsertAtMethod · 0.45
operator==Method · 0.45
ScriptArrayAt_GenericFunction · 0.45

Calls 1

SetExceptionMethod · 0.80

Tested by

no test coverage detected