Derma error with DNumberWang

[del]Exact error is:[/del]




addons\derma\lua\vgui\dnumberwang.lua:178: attempt to index local 'self' (a nil value)


Never mind, fixed that error because I used a . instead of a :

My code
[lua]
if SERVER then

concommand.Add( “SetRunSpeed”, SetRunSpeed )
concommand.Add( “SetWalkSpeed”, SetWalkSpeed )
function SetRunSpeed( ply, cmd, args )
if ValidEntity( ply ) and ply:EntIndex( ) ~= 0 then
if type( tonumber( args[ 1 ] ) ) == “number” then
ply:SetRunSpeed( math.Clamp( tonumber( args[ 1 ] ), 0, 1000 ) );
ply:ChatPrint( "Run speed is now " … args[1] )
end;
end;
end

function SetWalkSpeed( ply, cmd, args )
		if ValidEntity( ply ) and ply:EntIndex( ) ~= 0 then
			if type( tonumber( args[ 1 ] ) ) == "number" then
				ply:SetWalkSpeed( math.Clamp( tonumber( args[ 1 ] ), 0, 1000 ) );
				ply:ChatPrint( "Walk speed is now " .. args[1] )
			end;
		end;
	end

end
if CLIENT then

concommand.Add( “OpenSpeedMenu”, SpeedMenu )

function SpeedMenu()
	local DFrame = vgui.Create('DFrame')
	DFrame:SetSize(290, 150)
	DFrame:SetPos( ScrW( ) / 2 - DFrame:GetWide( ) / 2, ScrH( ) / 2 - DFrame:GetTall( ) / 2 );
	DFrame:SetTitle('Movement Speed')
	DFrame:SetDeleteOnClose(false)
	DFrame:SetBackgroundBlur(true)
	DFrame:MakePopup()

	local DButtonWalk = vgui.Create('DButton')
	DButtonWalk:SetParent(DFrame)
	DButtonWalk:SetSize(70, 20)
	DButtonWalk:SetPos(30, 50)
	DButtonWalk:SetText('Set')
	DButtonWalk.DoClick = function() 
		RunConsoleCommand( "SetWalkSpeed", DNumberWalk:GetValue() )
	end

	local DButtonRun = vgui.Create('DButton')
	DButtonRun:SetParent(DFrame)
	DButtonRun:SetSize(70, 20)
	DButtonRun:SetPos(30, 80)
	DButtonRun:SetText('Set')
	DButtonRun.DoClick = function() 
		RunConsoleCommand( "SetRunSpeed", DNumberRun:GetValue() )
	end
	
	local DPanelRun = vgui.Create('DPanel')
	DPanelRun:SetParent(DFrame)
	DPanelRun:SetSize(90, 20)
	DPanelRun:SetPos(190, 80)

	local DLabelRun = vgui.Create('DLabel')
	DLabelRun:SetParent(DFrame)
	DLabelRun:SetPos(200, 85)
	DLabelRun:SetText('Running Speed')
	DLabelRun:SizeToContents()

	local DPanelWalk = vgui.Create('DPanel')
	DPanelWalk:SetParent(DFrame)
	DPanelWalk:SetSize(90, 20)
	DPanelWalk:SetPos(190, 50)

	local DLabelWalk = vgui.Create('DLabel')
	DLabelWalk:SetParent(DFrame)
	DLabelWalk:SetPos(200, 55)
	DLabelWalk:SetText('Walking Speed')
	DLabelWalk:SizeToContents()

	local DNumberWalk = vgui.Create('DNumberWang')
	DNumberWalk:SetParent(DFrame)
	DNumberWalk:SetPos(120, 50)
	DNumberWalk:SetDecimals(0)
	DNumberWalk:SetFloatValue(0)
	DNumberWalk:SetFraction(0)
	DNumberWalk.OnMouseReleased = function()
		DNumberWalk:EndWang()
	end
	DNumberWalk.OnValueChanged = function() end
	DNumberWalk:SetValue('250')
	DNumberWalk:SetMinMax( 0, 500)

	local DNumberRun = vgui.Create('DNumberWang')
	DNumberRun:SetParent(DFrame)
	DNumberRun:SetPos(120, 80)
	DNumberRun:SetDecimals(0)
	DNumberRun:SetFloatValue(0)
	DNumberRun:SetFraction(0)
	DNumberWalk.OnMouseReleased = function()
		DNumberRun:EndWang()
	end
	DNumberRun.OnValueChanged = function() end
	DNumberRun:SetValue('500')
	DNumberRun:SetMinMax( 0, 1000)

	local DButtonAll = vgui.Create('DButton')
	DButtonAll:SetParent(DFrame)
	DButtonAll:SetSize(80, 30)
	DButtonAll:SetPos(110, 110)
	DButtonAll:SetText('Set All')
	DButtonAll.DoClick = function() 
		RunConsoleCommand( "SetWalkSpeed", DNumberWalk:GetValue() )
		RunConsoleCommand( "SetRunSpeed", DNumberRun:GetValue() )
		DFrame:Close()
	end


end

end

[/lua]

Another problem is that, this file is in the autorun folder in lua, and the concommands don’t work, they say unknown console command even though they autocomplete fine.

It’s fun learning lua when no one helps :\

[editline]02:03AM[/editline]

Well thanks for helping…

…I managed to get it working.