• Table icons...?
    1 replies, posted
[CODE]local grid = vgui.Create( "DGrid", iconchoose ) grid:SetPos( 5, 30 ) grid:SetCols( 5 ) grid:SetColWide( 24 ) grid:SetRowHeight( 24 ) icon={} icon[1]="icon16/heart.png" icon[2]="icon16/cog.png" icon[3]="icon16/star.png" icon[4]="icon16/box.png" icon[5]="icon16/book.png" for number = 1, 25 do icontable = ("\"icon["..number.."]\"") local icons = vgui.Create( "DButton" ) icons:SetText("") icons:SetImage(icontable) icons.Paint = function() end grid:AddItem( icons ) end[/CODE] So, yeah. I am pretty much trying to make a little panel that displays all five icons without having to make a seperate DButton and having to grid:AddItem() it for every single image. Any ideas guys?
why 'for numberr = 1, 25' instead of [lua]for num, path in pairs (icon) do --making button DButton:SetImage( path ) --rest of code end [/lua]
Sorry, you need to Log In to post a reply to this thread.