Syntax
Replaces every entry of the destination map with a copy of the source map's entries.
CopyMap(<source>(), <destination>())Parts
| <source> | The map to copy, with its parentheses: a(). |
|---|---|
| <destination> | The map that receives the copy, with its parentheses. Its old entries are lost. |
Returns
1 when the copy was made, 0 when the two maps do not hold the same type (the destination is then unchanged).
Good to know
- The copy is deep: records, lists and maps inside the entries are copied too, so changing the copy never changes the source. A handle inside an entry is not copied: both maps share it.
- The destination takes the source's current entry. Its PushMapPosition() stack is emptied.
b = adoes not copy a map: both names then point to the same map..i,.land.integercount as the same type;.iand.sdo not.
Example
NewMap a.i()NewMap b.i()a("gold") = 10b("old") = 1Console(Str(CopyMap(a(), b()))) ' 1b("gold") = 99Console(Str(a("gold")) + " " + Str(MapSize(b()))) ' 10 1In the manual : Arrays, lists and maps