Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

IUPLUA Putting Elements into the .gridbox with table.unpack doesn't work

local gridBox = iup.gridbox{
    table.unpack(Instances),
    --Instances[1],
    --Instances[2],
    numcolumns = 3,
    alignment = "ACENTER",
    expand = "YES"
}

When I run this in VSCode it will show only 1 Element of the Instance Table, which is always random, however if I do it with e.g. Instances[1] then they will show up to 100%. I however need it more "dynamically"

Tried puting in the table directly with

local gridBox = iup.gridbox{
    Instances,
    numcolumns = 3,
    alignment = "ACENTER",
    expand = "YES"
}

and like already mentioned with Instances[1]

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Do this instead:

local gridBox = iup.gridbox{
    numcolumns = 3,
    alignment = "ACENTER",
    expand = "YES",
    table.unpack(Instances)
}

When a function returns multiple values, if you want to keep them all rather than just the first, there can’t be a comma after it. Since order doesn’t matter otherwise in your case, just reordering them makes it work. If order did matter, then you’d need a more complicated solution instead, such as the one in my answer to this other question.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading