lynx_value_set_element

Introduction

Insert lynx_value element into array at the index specified.

Syntax

lynx_api_status lynx_value_set_element(lynx_api_env env,
                                       lynx_value object,
                                       uint32_t index,
                                       lynx_value value);

Parameters

KeyDescription
[in] envThe environment in which lynx value runs, typically nullptr.
[in] objectThe lynx_value representing array.
[in] indexThe index of the property to set.
[in] valueThe property value.

Return Value

Returns lynx_api_ok if the API succeeded. Returns lynx_api_array_expected if the types do not match.

Example

lynx_value array_value;
lynx_value_create_array(env, &array_value);
lynx_value v1;
lynx_value_create_int32(env, 10, &v1);
lynx_value_set_element(env, array_value, 0, v1);
// do something
lynx_value_remove_reference(env, map_value, NULL);
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.