For example, with the code you posted previously (the one with the class definitions), you could have:
function synth_definition:gui ()
local column = vb:column { style = "group" }
for i, child in ipairs(self) do
column:add_child (child:gui())
end
return column
end
function parameter_group:gui ()
local row = vb:row { style = "normal" }
for i, child in ipairs(self) do
row:add_child (child:gui())
end
return row
end
function parameter:gui ()
return vb:rotary { }
end
…and then you just need to call the “gui” method on the top object. Which will call recursively the same method on its children. The correct gui component will be constructed depending on the class of the objects, but you never have to check the types manually.