COPY(1) COPY(1)
NNAAMMEE
_c_o_p_y_(_) - returns a secure copy of any data type
SSYYNNOOPPSSIISS
mixed copy(mixed val)
DDEESSCCRRIIPPTTIIOONN
In LPC, mappings and arrays are pointers. This means that
if you set one mapping equal to another, making a change
in one will reflect a change in the other. To understand
this better, read up on these data types. Nevertheless,
there are times when you do not want to be passing around
these pointers. For example, if someone queries your
groups from the master object, you do not want them to get
your groups mapping and be able to modify it. Thus, you
return a copy of that mapping. This SimulEfun makes such
a safe copy.
EEXXAAMMPPLLEESS
+o given two mappings, mapping a and b, a = ([ "borg" : 1
]); b = a; the expression a == b is true. b = _c_o_p_y(a)
sets b equal to ([ "borg" : 1]), but a == b is false.
head1 NOTES
Use this only where absolutely needed for security
reasons. It is an expensive SimulEfun as far as CPU
resources are concerned.
LLOOCCAATTIIOONN
/secure/SimulEfun/copy.c
AAuutthhoorr
Descartes of Borg
1