obj_set_atΒΆ

obj_set_at adds a key-value pair to the given object. If the key already exists the value will be overwritten.

bool = obj_set_at(obj, key, val)

Return Value

bool is TRUE (1) if the key-value pair has been set or FALSE (0) if an error occurred.

Parameters

obj

obj is the object created with obj_create.

key

key is a number or string.

val

val is a number, a string or a complex number of a matrix of these types or an object created with obj_create.

Example

obj = obj_create()

// syntax 1
obj_set_at(obj, "a", 123)

// syntax 2
obj.set_at("a", 123)

// syntax 3
obj["a"] = 123

// syntax 4
obj.a = 123

id-253332