Difference between revisions of "Sprite:getNumChildren"

From GiderosMobile
(removed language stuff)
m (Text replacement - "<source" to "<syntaxhighlight")
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Returns the number of children of this sprite.
 
Returns the number of children of this sprite.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(number) = Sprite:getNumChildren()
 
(number) = Sprite:getNumChildren()
 
</source>
 
</source>
Line 13: Line 13:
  
 
=== Examples ===
 
=== Examples ===
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
local container1 = Sprite.new()
 
local container1 = Sprite.new()
 
local container2 = Sprite.new()
 
local container2 = Sprite.new()

Revision as of 14:31, 13 July 2023

Available since: Gideros 2011.6
Class: Sprite

Description

Returns the number of children of this sprite. <syntaxhighlight lang="lua"> (number) = Sprite:getNumChildren() </source>

Return values

Returns (number) the number of children of this sprite

Examples

<syntaxhighlight lang="lua"> 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 </source>