JsonArrayGetRange(json, int, int)
From NWN Lexicon
Jump to navigationJump to searchThe printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Returns a copy of the a range of values inside a json array.
Parameters
- jArray
- The json to get a range of values from
- nBeginIndex
- Starting index number (note arrays start at value 0)
- nEndIndex
- Ending index number
Description
Returns a copy of the range (nBeginIndex, nEndIndex) inclusive of jArray.
Negative nEndIndex values count from the other end.
Out-of-bound values are clamped to the array range.
Examples:
json a = JsonParse("[0, 1, 2, 3, 4]");
JsonArrayGetRange(a, 0, 1) // => [0, 1]
JsonArrayGetRange(a, 1, -1) // => [1, 2, 3, 4]
JsonArrayGetRange(a, 0, 4) // => [0, 1, 2, 3, 4]
JsonArrayGetRange(a, 0, 999) // => [0, 1, 2, 3, 4]
JsonArrayGetRange(a, 1, 0) // => []
JsonArrayGetRange(a, 1, 1) // => [1]
JsonArrayGetRange(a, 0, 1) // => [0, 1]
JsonArrayGetRange(a, 1, -1) // => [1, 2, 3, 4]
JsonArrayGetRange(a, 0, 4) // => [0, 1, 2, 3, 4]
JsonArrayGetRange(a, 0, 999) // => [0, 1, 2, 3, 4]
JsonArrayGetRange(a, 1, 0) // => []
JsonArrayGetRange(a, 1, 1) // => [1]
Returns a null type on error, including type mismatches.
Version
This function was added in 1.86.8193.34 of NWN:EE.
Example
See Also
functions: |