MCPcopy Create free account
hub / github.com/CytopiaTeam/Cytopia / At

Method At

external/as_add_on/scriptarray/scriptarray.cpp:890–905  ·  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

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

no outgoing calls

Tested by

no test coverage detected