Hi,
A small update. I managed to write some lua code allowing the following construct (using lua tables). It allows for a hierarchy of (nested) tables defining ui nodes to be created in a single statement. This more or less mimics the old ufo script behaviour, only then in lua. Currently the code to create a set of nodes looks like this:
node = {
_type = "panel",
_name = "pnlTest",
pos = { 10, 250 },
size = { 200, 200 },
layout = ufo.LAYOUT_TOP_DOWN_FLOW,
layoutmargin = 15,
backgroundcolor = { 0.50, 0.00, 0.00, 1.00 },
{
_type = "MainMenuBtn",
_name = "btnTest1",
text = "_Test 1"
},
{
_type = "MainMenuBtn",
_name = "btnTest2",
text = "_Test 2"
},
{
_type = "MainMenuBtn",
_name = "btnTest3",
text = "_Test 3"
}
}
...
do
wndMain = ufo.create_window ("main", nil)
wndMain:set_background ("ui/main_bg")
local pnlTest = build(node, wndMain)
...
The above results in the red panel on the left (see attached image). I'm going to work on this further but for now, it looks promising.
xray