MohoDoc:CountLayers()
Version added: before 9.5
Return value:
int32 the number of top-level layers in the document
An example of its use is:
This prints the names of all the top level layers (i.e. it does not print the names of layers contained in group type layers)
Note also that it is possible to avoid the use of local variables for ct and the MohoDoc and MohoLayer classes thus:
This is more compact, but if the program needs to make many references to (e.g.) data items within Layer(i) the first option layer = doc:Layer(i) is preferable.
local i
local doc = moho.document
local ct = doc:CountLayers()
for i = 0, ct-1 do
local layer = doc:Layer(i)
Print (layer:Name())
end
This prints the names of all the top level layers (i.e. it does not print the names of layers contained in group type layers)
Note also that it is possible to avoid the use of local variables for ct and the MohoDoc and MohoLayer classes thus:
local i
for i = 0, moho.document:CountLayers()-1 do
Print (moho.document:Layer(i):Name())
end
This is more compact, but if the program needs to make many references to (e.g.) data items within Layer(i) the first option layer = doc:Layer(i) is preferable.
Search results
Usage of 'CountLayers' is found in the following scripts:
AE Key Tools (Original Edition) by A.Evseeva
View Code
Multilayer magnet (Original Edition) by A.Evseeva
View Code
Reset layer transform (Original Edition) by A.Evseeva
View Code
Merge skeletons (Original Edition) by A.Evseeva
View Code
msDialog (Original Edition) by strider2000
View Code
AE Meshinstance (Original Edition) by A.Evseeva
View Code