It looks like you're new here. If you want to get involved, click one of these buttons!
local getTotalChildNum = nil getTotalChildNum = function(parent) local nc = 0 for index = 1,parent:getNumChildren() do nc = nc + 1 local child = parent:getChildAt(index) nc = nc + getTotalChildNum(child) end return nc end |
print ("Total children in stage: ".. getTotalChildNum(stage)) |