mud/lib/doc/sefun/copy
2020-09-06 05:43:07 -07:00

41 lines
1.3 KiB
Plaintext

COPY(1) COPY(1)
NAME
copy() - returns a secure copy of any data type
SYNOPSIS
mixed copy(mixed val)
DESCRIPTION
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 sefun makes such
a safe copy.
EXAMPLES
o given two mappings, mapping a and b, a = ([ "borg" : 1
]); b = a; the expression a == b is true. b = copy(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 sefun as far as CPU
resources are concerned.
LOCATION
/secure/sefun/copy.c
Author
Descartes of Borg
1