Difference between revisions of "Sprite:getNumChildren"

From GiderosMobile
(removed language stuff)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
'''Class:''' [[Sprite]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
+
 
=== <translate>Description</translate> ===
+
=== Description ===
<translate><br />
+
Returns the number of children of this sprite.
Returns the number of children of this sprite.<br />
 
<br /></translate>
 
 
<source lang="lua">
 
<source lang="lua">
 
(number) = Sprite:getNumChildren()
 
(number) = Sprite:getNumChildren()
 
</source>
 
</source>
=== <translate>Return values</translate> ===
+
 
'''<translate>Returns</translate>''' (number) <translate>The number of children of this sprite.</translate><br/>
+
=== Return values ===
=== <translate>Examples</translate> ===
+
'''Returns''' (number) the number of children of this sprite<br/>
'''Example'''<br/>
+
 
<source lang="lua">local container1 = Sprite.new()
+
=== Examples ===
 +
<source lang="lua">
 +
local container1 = Sprite.new()
 
local container2 = Sprite.new()
 
local container2 = Sprite.new()
  
Line 24: Line 24:
 
container1:addChild(sprite2)
 
container1:addChild(sprite2)
  
print(container1:getNumChildren()) --&gt; 2
+
print(container1:getNumChildren()) --> 2
print(container2:getNumChildren()) --&gt; 1
+
print(container2:getNumChildren()) --> 1
print(sprite1:getNumChildren()) --&gt; 0
+
print(sprite1:getNumChildren()) --> 0
print(sprite2:getNumChildren()) --&gt; 0</source>
+
print(sprite2:getNumChildren()) --> 0
 +
</source>
  
 
{{Sprite}}
 
{{Sprite}}

Revision as of 18:27, 9 December 2021

Available since: Gideros 2011.6
Class: Sprite

Description

Returns the number of children of this sprite.

(number) = Sprite:getNumChildren()

Return values

Returns (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