What wrong with list.get ?

I get a number of the table instead to get the word I set in the table why and what is this weird number ?


table:0335C370

[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:SetPos(50,50)
frame:SetSize(300,350)
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.
frame:SetDraggable(true)
frame:ShowCloseButton(true)
frame:MakePopup()

local DermaListView = vgui.Create(“DListView”)
DermaListView:SetParent(frame)
DermaListView:SetPos(25, 50)
DermaListView:SetSize(250, 270)
DermaListView:SetMultiSelect(false)
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

end

concommand.Add(“tesst”,frame_create)
[/lua]

A table is not a value, but a container.
You need to access the values of this container for example by doing this

[lua]
for v,k in pairs(list.Get(“myList”)) do
DermaListView:AddLine(k)
end
[/lua]

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 )
end
[/lua]

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()?

http://luabin.foszor.com/code/lua/includes/modules/list.lua
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.