Difference between revisions of "Sprite:getNumChildren"
From GiderosMobile
Line 2: | Line 2: | ||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
=== Description === | === Description === | ||
− | <br /> | + | <translate><br /> |
Returns the number of children of this sprite.<br /> | Returns the number of children of this sprite.<br /> | ||
− | <br /> | + | <br /></translate> |
<source lang="lua"> | <source lang="lua"> | ||
(number) = Sprite:getNumChildren() | (number) = Sprite:getNumChildren() | ||
</source> | </source> | ||
=== Return values === | === Return values === | ||
− | '''Returns''' (number) The number of children of this sprite.<br/> | + | '''Returns''' (number) <translate>The number of children of this sprite.</translate><br/> |
=== Examples === | === Examples === | ||
'''Example'''<br/> | '''Example'''<br/> | ||
− | <source lang="lua">local container1 = Sprite.new() | + | <source lang="lua">local container1 = Sprite.new() |
− | local container2 = Sprite.new() | + | local container2 = Sprite.new() |
− | + | ||
− | local sprite1 = Sprite.new(); | + | local sprite1 = Sprite.new(); |
− | local sprite2 = Sprite.new(); | + | local sprite2 = Sprite.new(); |
− | + | ||
− | container2:addChild(container1) | + | container2:addChild(container1) |
− | container1:addChild(sprite1) | + | container1:addChild(sprite1) |
− | container1:addChild(sprite2) | + | container1:addChild(sprite2) |
− | + | ||
− | print(container1:getNumChildren()) --> 2 | + | print(container1:getNumChildren()) --> 2 |
− | print(container2:getNumChildren()) --> 1 | + | print(container2:getNumChildren()) --> 1 |
− | print(sprite1:getNumChildren()) --> 0 | + | print(sprite1:getNumChildren()) --> 0 |
print(sprite2:getNumChildren()) --> 0</source> | print(sprite2:getNumChildren()) --> 0</source> |
Revision as of 13:32, 23 August 2018
Available since: Gideros 2011.6
Description
Returns the number of children of this sprite.
(number) = Sprite:getNumChildren()
Return values
Returns (number) The number of children of this sprite.
Examples
Example
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