Garry's Mod Wiki

Revision Difference

DListView:GetLines#527965

<function name="GetLines" parent="DListView" type="panelfunc"> <ispanel>yes</ispanel> <description>Gets all of the lines added to the DListView.</description> <realm>Client</realm> <rets> <ret name="" type="table">The lines added to the DListView.</ret> </rets> </function> <example> <description>Loops through all of the lines of a DListView and prints their first value.</description> <code> local list = vgui.Create( "DListView" ) list:AddColumn( "Fruit" ) ⤶ local lines = { "Apple", "Orange", "Banana" }⤶ ⤶ for _, line in pairs( lines ) do⤶ ⤶ for _, line in ipairs( { "Apple", "Orange", "Banana" } ) do⤶ list:AddLine( line ) end for k, line in pairs( list:GetLines() ) do for k, line in ipairs( list:GetLines() ) do print( k, line:GetValue( 1 ) ) end </code> <output> 1 Apple<br/>⤶ 2 Orange<br/>⤶ 3 Banana⤶ ```⤶ 1 Apple⤶ 2 Orange⤶ 3 Banana⤶ ```⤶ </output> ⤶ </example></example>