gre.clone_object( reference_object_name, new_object_name, parent_name, data )
Create a new control, table or group (new_object_name) within an existing parent (parent_name) by copying all of the properties of an existing object (reference_object_name). This new object will have all of the same actions, variables and it's current state will match the state of the reference object that is being copied. In the case of cloning groups, all of the reference group's controls will be cloned into the new group.
Currently only controls and groups are supported as source reference objects.
Controls and tables can be cloned into either layer or group parents as long as no name conflict exists.
Groups can be cloned into layer parents as long as no name conflict exists.
The data argument is a table of properties that match the properties for that type of object as described
in the gre.set_control_attrs
, gre.set_table_attrs
or gre.set_group_attrs
functions as applicable. For
example, most objects support
x, y,hidden
properties
Parameters:
reference_object_name The name of the object that will be cloned. This may be a fully qualified name
of a group or control
new_object_name The name for the new object, this must be a unique name in the parents namespace
parent_name The name of the layer or group to place this object within, this object must exist
data Optional: A table containing control attribute tags as the keys with new values to be applied.
Example:
function create_new_control() local data = {} data["x"] = 10 data["y"] = 10 gre.clone_object("my_control", "my_new_control", "my_layer", data) end