I’m using the Roact module for creating GUIs, but I don’t want to declare everything, just the items which don’t change. Imagine that I have the following table:
But, after the conversion, there’s a way to get the whole table? Because when you do lookThrough(), I was looking for a way to join this w/ the main table.
Is what you’re trying to do is to iterate over all frames?
Yep, but I’m trying to join the objects passed in lookThrough() into the main table, like this:
local convertedTable = {
["Frame1"] = Roact.createElement("Frame", {
-- converted properties here
}, -- table of all Frame1 children here)
-- other roact elements with children...
}
I’m trying to figure out how to properly render an object children, and the children children, and so on.
I see, so for each object, you want to create a roact element out of it. Is that it?
Maybe this:
function lookThrough(tabl, parent)
for k,v in pairs(tabl) do
local obj = Roact.createElement(v.className, v.properties)
if v.children ~= nil then
lookThrough(v, obj)
end
Roact.mount(obj, parent)
end
end