JsonArrayDelInPlace(json, int)

From NWN Lexicon
Jump to navigationJump to search
Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.

Modifies jArray in-place (with no memory copies needed).

void JsonArrayDelInplace(
    json jArray,
    int nIndex
);

Parameters

jArray
The json Array to modify.
nIndex
The index of the value to delete.


Description

Removes the element at nIndex in the jArray and resizes it down by one.

Remarks

Will do nothing if jArray is not an array or nIndex is out of range. If the json array is stored in a local variable, this will automatically update said variable without having to set it again.

Version

This function was added in 88.8193.36-11 of NWN:EE.

Example

void main()
{
    json jArray = JsonParse("{[1, 2, 3, 4, 5]}");
    // Delete the element at position 2 (the third element, which is '3')
    JsonArrayDelInplace(jArray, 2);
    WriteTimestampedLogEntry(JsonDump(jArray)); // {[1, 2, 4, 5]}
}

See Also

functions:

JsonArrayDel JSON Functions