Adding lines to DListView to specfic columns?

Yello, I am trying to add lines in DListView to spesfic columns.

So something like this:

					local Col1 = searchlist:AddColumn("On Perp")
					local Col2 = searchlist:AddColumn("Perps Pocket")

				        Col1:AddLine("This will show up in the first column")
                                        Col2:AddLine("This will show up in the second column")

Can’t really find anything on it. Is it possiable?

Overall what I am trying to do is I have a table with two sub tables. One shows thing the person ahs equipped the other shows things in his pocket.
Since both sub tables will have a random amount of keys I can’t really go foward adding lines like (table.subtable1(k valure), table.subtable2(k value))

I think, using DListLayout with buttons is easier. But if you’re not ok, you can try to store lines in tables and use

unpack. But there always will be an empty line in another column.

local lines = {{"First column", "Second column", "", "Fourth column"}}

I didn’t understand any of this …

in lua, think of varargs as a sort of object which in theory holds an infinite amount of values to be passed onto a function.

some lua functions take varargs (or variable arguments). a common example of this is print().

in print, no matter how many seperate arguments you prepend with a comma, it prints them out using it’s print function seperated by the tab character.

what the unpack function does is turn a table into varargs to be passed to a function

a better way to visualize varargs is this


is functionally equivalent to this

local sometab = {
[1] = "hey",
[2] = "you",
[3] = "you're",
[4] = "a",
[5] = "rockstar",
print( unpack(sometab) )

or this

local someothertab = {"hey","you","you're","a","rockstar}
print( unpack(someothertab) )

essentially, when you use unpack({}) with a table within an argument of a function, it is functionally equivalent to passing on each element of the table in order one by one.

so iJohnny’s code is the functional equivalent of doing this

dlistview:AddLine("First column", "Second column", "", "Fourth column")

hope i clarified a few things for you, i’m not the absolute best at explaining complex subjects

I understood it but I found an easier way of doing it. I just made 2 DListViews with 1 column instead of 1 dlistview with 2 columns.

Honestly that looks like a kludge to me instead of a proper solution.

Maybe, but it’s easier and it doesn’t go against what the DList is supposed to do.

I’m not sure why it would be easier than a single listview. Can you elaborate on that a bit?