StructUpdate()
Updates a key with a value.
StructUpdate( struct=struct, key=string, value=any );
Returns: Boolean
| Argument | Description |
|---|---|
|
struct
struct,
required
|
edit
Structure to update Alias: structure, object |
|
key
string,
required
|
edit
Key, the value of which to update |
|
value
any,
required
|
edit
New value |
Examples
editNon-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
- Structures
- struct.update()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)