StructInsert()
Inserts a key-value pair into a structure.
StructInsert( struct=struct, key=string, value=any, allowOverwrite=boolean );
Returns: Boolean
Examples
Non-Member Function
animals = {
cow: "moo",
pig: "oink"
};
// Show current animals
Dump(
label: "Current animals",
var: animals
);
// Insert cat into animals
StructInsert(animals, "cat", "meow");
// Show animals, now includes cat
Dump(
label: "Animals with cat added",
var: animals
);
See also
- Structures
- Collections
- struct.insert()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)