• Client side LUA error.
    9 replies, posted
So I am leaning glua and I were making a menu. And then this error comes up. (Client side error) [CODE] [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 [/CODE] The code. [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 [/CODE] Please help.
It should be mainpanel.Paint
[QUOTE=code_gs;52558787]It should be mainpanel.Paint[/QUOTE] Thank you but now this comes up. [CODE] [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 [/CODE] menu_main.lua: [CODE] 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" ) [/CODE] cl_init.lua [CODE] 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) [/CODE] 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?
[CODE] local sheet1 = vgui.Create( "DPane", colsheet ) [/CODE] Well, for starters you misspelled DPanel.
[QUOTE=-Raven-;52558933][CODE] local sheet1 = vgui.Create( "DPane", colsheet ) [/CODE] Well, for starters you misspelled DPanel.[/QUOTE] Yes thank you that fixed it. Sorry but yet another error Error: [CODE] [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] Code: [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 ) [/CODE]
Try this. [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/DPanel/SetBackgroundColor]DPanel:SetBackgroundColor[/url]
[QUOTE=-Raven-;52558978]Try this. [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/DPanel/SetBackgroundColor]DPanel:SetBackgroundColor[/url][/QUOTE] Yes that worked but this is the last thing. (I hope) The error [CODE] [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 [/CODE] The code [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 [/CODE] 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.
Sorry, you need to Log In to post a reply to this thread.