vancegroup / vr-jugglua

VR JuggLua: A Framework for VR Applications Combining Lua, OpenSceneGraph, and VR Juggler
Boost Software License 1.0
11 stars 12 forks source link

Lua iterator for child nodes in osgLua #45

Open rpavlik opened 12 years ago

rpavlik commented 12 years ago

Currently we have to do something like this to visit children:

for i=1,node.getNumChildren() do
  func(node.getChild(i-1))
end

(or something similar, using array properties.

It would be good to be able to do something like this:

for child in osgLua.children(node) do
  func(child)
end

or perhaps combining with array properties,

for child in node.Children:each() do
  func(child)
end

@lpberg - what do you think of the usability of these options?

Implementation info: see http://www.luafaq.org/#T1.13