MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | |
| 2 | ********************************************************** |
| 3 | * ACHTUNG: EFUN EXISTIERT NICHT MEHR! NICHT VERWENDEN! * |
| 4 | ********************************************************** |
| 5 | |
| 6 | SYNOPSIS: |
| 7 | mapping copy(mapping) |
| 8 | |
| 9 | DESCRIPTION: |
| 10 | Create a shallow copy of <arg> and return it. For arrays and mappings |
| 11 | this means that a new array or mapping is created with copies of the |
| 12 | original content. Embedded arrays and mappings are copied by reference! |
| 13 | |
| 14 | EXAMPLE |
| 15 | mixed *a, *b; |
| 16 | |
| 17 | a = ({ 1, ({ 21, 22 }) }); |
| 18 | b = copy(a); |
| 19 | a[0] = -1; a[1][0] = -21; |
| 20 | --> a is now ({ -1, ({ -21, 22 }) }) |
| 21 | b is now ({ 1, ({ -21, 22 }) }) |
| 22 | |
| 23 | WARNING |
| 24 | Keep in mind, that a copy of a mapping, that contains arrays/mappings, |
| 25 | contains references to these Mappings/Arrays, not real copies. If you |
| 26 | don't take care, you can a) change the original mappings while working |
| 27 | on the copy and b) create recursive mappings, that leak memory. |
| 28 | |
| 29 | HISTORY |
| 30 | Superseeded by the copy() efun. |
| 31 | Removed in LDMud 3.3 and LP "03.02.1@150". |
| 32 | |
| 33 | SEE ALSO: |
| 34 | mappings(LPC) |
| 35 | |
| 36 | 26. September 2006, Zesstra |