gobj_write_str_attr()

gobj_write_str_attr()#

Sets the value of a string attribute in the given hgobj object. If the attribute does not exist, a warning is logged.

Prototype

int gobj_write_str_attr(
    hgobj gobj,   /* Object whose attribute is being modified */
    const char *name,   /* Name of the attribute */
    const char *value   /* New string value to set */
);

Parameters

Key

Type

Description

gobj

hgobj

The hgobj object whose attribute is being modified.

name

const char *

The name of the attribute to modify.

value

const char *

The new string value to set. If NULL, the attribute is set to json_null().


Return Value

Returns 0 on success, or -1 if the attribute does not exist.

Notes

If the attribute does not exist in the hgobj, a warning is logged. If the hgobj has a mt_writing method, it is called after updating the attribute.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples