Client side LUA error.

So I am leaning glua and I were making a menu. And then this error comes up. (Client side error)



[Android|2|STEAM_0:0:0000000] Lua Error:

[ERROR] gamemodes/testgamemode/gamemode/vgui/menu_main.lua:38: function arguments expected near '='
  1. unknown - gamemodes/testgamemode/gamemode/vgui/menu_main.lua:0


The code.




	local mainpanel = vgui.Create( "DPanel", self )
		mainpanel:SetPos( 3, 35 )
		mainpanel:SetSize( x - 6, y - 35 - 3 )
		mainpanel:Paint = function( self, w, h )
			draw.RoundedBox( 0, 0, 0, w, h, Color( 100, 100, 100, 100) )
		end



Please help.

It should be mainpanel.Paint

Thank you but now this comes up.



[ERROR] gamemodes/testgamemode/gamemode/vgui/menu_main.lua:46: attempt to index local 'sheet1' (a nil value)
  1. Init - gamemodes/testgamemode/gamemode/vgui/menu_main.lua:46
   2. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:37
    3. func - gamemodes/testgamemode/gamemode/cl_init.lua:65
     4. unknown - lua/includes/extensions/net.lua:32


menu_main.lua:



local sheet1 = vgui.Create( "DPane", colsheet )
--46		sheet1:Dock( FILL )
		sheet1.Paint = function( self, w, h )
			draw.RoundedBox( 0, 0, 0, w, h, Color( 10, 10, 10, 100) )
		end
		colsheet:AddSheet( "Teams", sheet1, "Icon16/door_open.png" )


cl_init.lua



net.Receive( "f4menu", function()
	if( !MainMenu ) then
--65  	MainMenu = vgui.Create( "menu_main" )
		MainMenu.SetVisible( false )
	end
	
	if( MainMenu:IsVisible() ) then
		MainMenu:SetVisible( false )
		gui.EnableScreenClicker( false )
	else
		MainMenu:SetVisible( true )
		gui.EnableScreenClicker( true )
	end
	
end)


I am guessing it is the same for the sheet1:Dock( FILL ) to be a . instead of :? And if so is it for DockMargin, DockPadding also?



local sheet1 = vgui.Create( "DPane", colsheet )


Well, for starters you misspelled DPanel.

Yes thank you that fixed it.
Sorry but yet another error

Error:



[ERROR] gamemodes/testgamemode/gamemode/vgui/menu_main.lua:57: attempt to call field 'SetColor' (a nil value)
  1. Init - gamemodes/testgamemode/gamemode/vgui/menu_main.lua:57
   2. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:37
    3. func - gamemodes/testgamemode/gamemode/cl_init.lua:65
     4. unknown - lua/includes/extensions/net.lua:32


Code:



		local teammenu = vgui.Create( "DPanel", sheet1 )
		teammenu:Dock( TOP )
		teammenu:DockMargin( 15, 10, 15, 10)
		teammenu:DockPadding( 290, 10, 290, 10)
		teammenu:SetSize( 100, 50 )
--57		teammenu:SetColor( 255, 255, 255, 255 )


Try this.

DPanel:SetBackgroundColor

Yes that worked but this is the last thing. (I hope)
The error



[ERROR] lua/derma/derma_gwen.lua:21: bad argument #3 to 'SetDrawColor' (number expected, got no value)
  1. SetDrawColor - [C]:-1
   2. Normal - lua/derma/derma_gwen.lua:21
    3. unknown - lua/skins/default.lua:315


The code



Paint = function( self, w, h )
		
		draw.RoundedBox( 0, 0, 0, w, h, Color( 10, 10, 10, 150) )
		surface.SetDrawColor( 255, 255, 255, 255 )
		surface.DrawOutlinedRect( 2, 2, w-4, h-4)
		
	end


The “Paint” thing were mentioned before. But the SetDrawColor() is the issue. This one is the last thing in the list.

That error isn’t related to the PANEL.Paint function. Post the full code.

Why are you doing draw.RoundedBox with 0 as round argument, just do surface.DrawRect() and save 8 drawcalls (In case that behavior changed)

I fixed it. Removed the thing and made a text and a button. Something were wrong with the DPanel. Propably because I accidentally put it outside my DColumnSheet.