Script Library: 1213 scripts
 

cloneobj.r

REBOL [ Title: "Object Cloner" Date: 30-Jun-2000 File: %cloneobj.r Author: "Erin A. Thomas" Purpose: { Clone objects recursively. This way the objects inside are copies instead of references. } Email: %timewarp--sirius--com Example: { new-object clone make existing-object [] } library: [ level: 'intermediate platform: none type: 'tool domain: none tested-under: none support: none license: none see-also: none ] ] clone: func [ "Clones all sub objects so there are no multiple references" o [object!] "The object to clone" /local wrd so ] [ foreach wrd next first o [ if object? so: get in o :wrd [(set in o :wrd make so []) (clone so)] ] return o ]
halt ;; to terminate script if DO'ne from webpage
Notes
  • email address(es) have been munged to protect them from spam harvesters. If you are a Library member, you can log on and view this script without the munging.
  • (timewarp:sirius:com)