I get a number of the table instead to get the word I set in the table why and what is this weird number ?
[lua]function frame_create() --Note that I changed the function name. You can change the fucntion name to anything you want
frame = vgui.Create(“DFrame”)
frame:SetTitle(“Testing Derma Controls”)
frame:SetVisible(true) --This is important to set false or your frame will pop-up every time you join to server or a single player game.
local DermaListView = vgui.Create(“DListView”)
DermaListView:AddColumn(“Name”) – Add column
DermaListView:AddColumn(“Test”) – Add column
list.Add( "myList", "Hello" )
list.Add( "myList", "World" )
DermaListView:AddLine( list.Get("myList") ) -- Add lines
A table is not a value, but a container.
You need to access the values of this container for example by doing this
for v,k in pairs(list.Get(“myList”)) do
Thanks it working , If I want to show " myList " in the first column how I can do that ?
I tried with : (but it show in the table 1: Hello , 2: World 3x times)
[lua]for v,k in pairs(list.Get(“myList”)) do
DermaListView:AddLine( v,k )
have you considered DermaListView:AddLine( v:Name(), v:Item() )
i don’t know if this will work, because i have never even touched lists, But it’s worth a shot, i went to the wiki and read the list.Add inputs, and it’s name, item
Although, list.Get only has one parameter, which is the name of the list…So…v:Name()?
The list module is just some funny shit Garry made up when he was sleeping.
You are better off using a normal table.
It does have the advantage of not polluting the global table, though the overhead for getting and setting is a bit unreasonable.
I’ve always imagined that the list module is a hangover from an earlier version of garrysmod where it was harder to do tables.
If you ask me, the global table is kinda over polluted anyway
Aualin, the point is to pollute it less. Not to remove all excess stuff.