CopyLayer(id, pos[, t])
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:
Hidden: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.
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.