Table of Contents

Sprite:getNumChildren

Available since version: Gideros 2011.6

Description:

Returns the number of children of this sprite.

Syntax:

(number) = Sprite:getNumChildren()

Return value:

  • number: The number of children of this sprite.

Examples:

local container1 = Sprite.new()
local container2 = Sprite.new()

local sprite1 = Sprite.new();
local sprite2 = Sprite.new();

container2:addChild(container1)
container1:addChild(sprite1)
container1:addChild(sprite2)

print(container1:getNumChildren()) --> 2
print(container2:getNumChildren()) --> 1
print(sprite1:getNumChildren()) --> 0
print(sprite2:getNumChildren()) --> 0