Add function to get all child parts recursively
This commit is contained in:
parent
6f37b20c5d
commit
cf7db74863
15
script.lua
15
script.lua
@ -184,6 +184,21 @@ function debugPrint(var)
|
|||||||
return var
|
return var
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Recursively walk a model tree and return a table containing the group and each of its sub-groups
|
||||||
|
--- @param group table The group to recurse
|
||||||
|
--- @return table Resulting table
|
||||||
|
function recurseModelGroup(group)
|
||||||
|
local t={}
|
||||||
|
table.insert(t, group)
|
||||||
|
if group.getType()=="GROUP" then
|
||||||
|
for k, v in pairs(group.getChildren()) do
|
||||||
|
for _, v2 in pairs(recurseModelGroup(v)) do
|
||||||
|
table.insert(t, v2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return t
|
||||||
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- master state variables and configuration (do not access within pings) -- {{{
|
-- master state variables and configuration (do not access within pings) -- {{{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user