lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

I found a workaround by using autogenerated code using loadstring() as
bellow :

...
            local code = [[
tree = Gtk.TreeView {
    id = 'list',
    model = list,
    Gtk.TreeViewColumn {
        title = "Ignore it ?",
        sizing = 'FIXED',
        fixed_width = 70,
        {
            Gtk.CellRendererToggle { id = 'ignored' },
        }
    },
]]
            for i=1, #current_list do
                code = code .. [[
    Gtk.TreeViewColumn {
        title = "]] .. current_list[i] .. [[",
        {
            Gtk.CellRendererText {}
        }
    },
]]
            end

            code = code .. "}"
            loadstring( code )()
...

But it looks like a bit cumbersome. And I would like to understand why
my initial code doesn't work.

Thanks