Texture:getLayerCount
Gets the number of layers / slices in an Array Texture. Returns 1 for 2D, Cubemap, and Volume textures.
layers = Texture:getLayerCount()
layers number The number of layers in the Array Texture.