Need explanation for Panel

Hi all !

I’m new to Lua and I want to know just 2 little things.

First: In my title of my slider the value of the slider stay to 0 and doesn’t show properly ( with the GetValue) some one can help me how to set it properly ?

2nd: I have some problem to figure out (just in example but for now is not in my code) what is the argument in the most common code of some people I see.


function myCommand (ply, weapon, DermaPanel)

[lua]function myCommand()

local DermaPanel = vgui.Create( “DFrame” )
DermaPanel:SetPos( 50 , 50 )
DermaPanel:SetSize( 300, 325 )
DermaPanel:SetTitle( “HUD Test” )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )

local NumSlider = vgui.Create( “DNumSlider”, DermaPanel )

local test = "test is: " …NumSlider:GetValue()… “!”

NumSlider:SetPos( 25, 100 )
NumSlider:SetWide( 150 )
NumSlider:SetMin( 25 )
NumSlider:SetMax( 500 )	
NumSlider:SetText( test )
NumSlider:SetDecimals( 0 ) -- Sets a decimal. Zero means it's a whole number	
NumSlider:SetValue( 5 )
print ( test )



Thanks for the help.

  • snip -

Arguments are: “ply, cmd, args”

Should be:

Hey. You there.

[lua]local function myCommand()[/lua]


[lua]function myCommand()[/lua]

Can you explain about why I don’t need the 2nd myCommand (Just for understand better)

and what is exactly ply (not sure ply = Localplayer() ?) , cmd and args ?

Thanks for the help :slight_smile:

ply is the player who said the concommand. Notice this could be pl, ply, p or whatever, and no ply would only be LocalPlayer() if you set it to be with ‘ply = LocalPlayer()’ on the client.

cmd is the concommands name.

args is anything put after concommand, in a table.