StructUpdate

Updates a key with a value.

Returns: boolean

Usage

StructUpdate( structure, key, value )

Arguments

Argument Description
structure
(struct, required)

Structure to update

key
(string, required)

Key, the value of which to update

value
(any, required)

New value

Examples

Member Function

animals = {
	cow: "moo",
	pig: "oink",
	cat: "meow"
};

// Show current animals
Dump(
	label: "Current animals",
	var: animals
);

// Update cat in animals
animals.update("cat", "purr");

// Show animals with updated cat in animals
Dump(
	label: "Animals with cat updated",
	var: animals
);

Non-Member Function

animals = {
	cow: "moo",
	pig: "oink",
	cat: "meow"
};

// Show current animals
Dump(
	label: "Current animals",
	var: animals
);

// Update cat in animals
StructUpdate(animals, "cat", "purr");

// Show animals with updated cat in animals
Dump(
	label: "Animals with cat updated",
	var: animals
);

See also