JsonArraySetInplace(json, int, json)

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.

Sets the value at nIndex in jArray to jValue (with no memory copies needed).

void JsonArraySetInplace(
    json jArray,
    int nIndex,
    json jValue
);

Parameters

jArray
The json Array to modify.
nIndex
The index to set for a value.
jValue
The json value to set.

Description

Sets the value at nIndex in jArray to jValue in-place (with no memory copies needed).

Remarks

Will do nothing if jArray is not an array or nIndex is out of range.

Version

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

Example

void main() 
{
    json jArray = JsonParse("{[1, 2, 5, 4]}");
	
    // Set index 2 (value 5) to 3.
    JsonArraySetInplace(jArray, 2, JsonInt(3));
    WriteTimestampedLogEntry(JsonDump(jArray)); // {[1, 2, 3, 4]}
}

See Also

functions:

JsonArraySet JSON Functions