MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / ParamToZeroIndex

Method ParamToZeroIndex

source/script_object.cpp:2036–2045  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2034}
2035
2036Array::index_t Array::ParamToZeroIndex(ExprTokenType &aParam)
2037{
2038 if (!TokenIsNumeric(aParam))
2039 return -1;
2040 auto index = TokenToInt64(aParam);
2041 if (index <= 0) // Let -1 be the last item and 0 be the first unused index.
2042 index += mLength + 1;
2043 --index; // Convert to zero-based.
2044 return index >= 0 && index <= MaxIndex ? UINT(index) : BadIndex;
2045}
2046
2047
2048ResultType Array::GetEnumItem(UINT &aIndex, Var *aVal, Var *aReserved, int aVarCount)

Callers

nothing calls this directly

Calls 2

TokenIsNumericFunction · 0.85
TokenToInt64Function · 0.85

Tested by

no test coverage detected