Name
CopyLayer -- clone a layer (V9.1)
Synopsis
CopyLayer(id, pos[, t])
Function
This command clones the layer specified by id and inserts the copy into the layer position specified by pos. The special value 0 can be passed in pos to insert the cloned layer as the last one. CopyLayer() will clone all layer attributes except the layer's name because that must be unique. You can use the optional table argument t to specify a name for the cloned layer.

The optional table argument supports these tags:

Name:
If you want to assign a name to the new layer, set this tag to a string containing the desired name. By default, the new layer won't be given a name.

Hidden:
This tag can be set to True to automatically hide the new layer after creation. Defaults to False.

You need to enable layers before you can use this command. See Layers introduction for details.

Inputs
id
identifier or name of the layer to clone
pos
desired position for the new layer or 0 for last layer
t
optional: table containing further parameters
Example
EnableLayers
SetFillStyle(#FILLCOLOR)
Box(0, 0, 320, 480, #RED)
CopyLayer(1, 2, {Hidden = True})
SetLayerStyle(2, {X = 320, Color = #BLUE, Hidden = False})
The code above creates a filled red rectangle layer, clones it, changes the color of the cloned layer to blue and positions it next to the red layer.

Show TOC