blob: 60a436289173c551f10e7a568e76b9f6b9ac8c77 [file] [log] [blame]
SYNOPSIS
mapping m_add(mapping map, mixed key, [mixed data...])
DESCRIPTION
Add (or replace) an entry with index <key> in mapping <map>.
The modified mapping is also returned as result.
The values for the entry are taken from the <data> arguments.
Unassigned entry values default to 0, extraneous <data> arguments
are ignored.
The difference between m_add() and the operator += is that for
the latter you might need to create a temporary mapping that
contains the entries to add, which m_add() doesn't.
EXAMPLES
mapping m;
m = ([ "foo" ]);
m_add(m, "bar", 1) --> ([ "foo", "bar" ])
m = ([ "foo":1 ]);
m_add(m, "bar", 1) --> ([ "foo":1, "bar":1 ])
m = ([ "foo":1;2 ]);
m_add(m, "bar", 1) --> ([ "foo":1;2, "bar":1;0 ])
m_add(m, "baz", ({ 4, 5 })... )
--> ([ "foo":1;2, "bar":1;0, "baz":4;5 ])
HISTORY
Introduced in LDMud 3.2.9.
SEE ALSO
mappingp(E), mkmapping(E), m_delete(E), m_entry(E), m_indices(E),
m_values(E), sizeof(E), widthof(E)