[SOLVED] Name layers + number

hi, im creating a tool panel with some buttons to agilize the workflow. I made a NEW LAYER button but it creates my layers with a single name, how could I make it like the default new Layer? (Layer 1, Layer 2, Layer 3)
if there is any place where I can check a documentation about it ill be more than happy to dig into that

Hi @JosethSC,

Take a look at the tail end of this thread:

The basic idea is to loop through the sprite layers in a recursive function, counting layers except those in categories you don’t want (for example reference layers or the background layer). If the current layer is a group, then the recursive function calls itself, supplying the layer’s children.

Then create the layer and assign its name. For extra number formatting, look into Lua’s documentation on string.format.


thank you! will check the thread and try that out :slight_smile: