.. highlightlang:: us .. _obj_copy: obj_copy ======== .. index:: obj_copy .. us.tag obj_copy NOTREADYENGLISH New410 obj :ref:`obj_copy` creates a copy of an object. .. function:: o = obj_copy(obj) .. us.return **Return Value** *o* is the copied object of *obj*. .. us.params **Parameters** .. uparam:: obj *obj* is an object created with :ref:`obj_create`. .. us.example **Example** :: o = obj_create() o.a = 1 o.b = 2 o2 = o.copy() print o2.a print o2.b .. us.comment **Comment** The function can also copy objects with references, e.g.: :: o = obj_create() o.val = 123 o.next = obj_create() o.next.val = 456 o.next.next = o a = o.copy() The function copies the parent object and the object with the methods. After ``a = o.copy()`` ``a`` and ``o`` have the same parent object and the same object with the methods. .. seealso:: :ref:`overview-uniscript-objects`, :ref:`obj_save`, :ref:`obj_load`, :ref:`obj_set_parent`, :ref:`obj_set_methods` :sub:`id-189522`