To start off, i'm quite new to lua.
I'm trying to make it so when i have selected an option (a prop), I want it to print the actual model of it in console. I've put the options into a table, k is the option, and v is the model. The following code prints the option, but I can't figure out how to get it to print the model. If anyone can tell me how to do this i'd greatly appreciate it. Thanks
concommand.Add( "propmenu", function()
local propmenu = vgui.Create( "DFrame" )
propmenu:SetPos( ScrW() * .35, ScrH() * .3 )
propmenu:SetSize( 200, 200 )
propmenu:SetTitle( "Select a prop" )
propmenu:SetVisible( true )
propmenu:SetDraggable( true )
propmenu:ShowCloseButton( true )
propmenu:MakePopup()
propList={}
propList["Chair"] = "models/props/cs_office/Chair_office.mdl"
propList["Rollermine"] = "models/Roller.mdl"
local pList = vgui.Create("DComboBox", propmenu );
pList:SetPos( 50, 50 )
pList:SetSize( 100, 20 )
for k,v in pairs(propList) do
pList:AddChoice( k )
local pButton = vgui.Create( "DButton" )
pButton:SetParent(propmenu)
pButton:SetPos( 75, 150 )
pButton:SetText( "OK" )
pButton:SetSize( 60, 30 )
pButton.DoClick = function()
local selected = pList:GetSelected()
print(selected)
propmenu:Close()
end
end
end)