-1

Pls can u help me, thats not all of the code but in this piece problem. Thats Glua and i hope u help me!!!

local dPanelButton1 = vgui.Create( 'DButton', dPanelDa) --Кнопка для лотки
    dPanelButton1:SetSize( 250, 50 )
    dPanelButton1:SetPos( 625, 370 )
    dPanelButton1:SetText( '' )

    dPanelButton1.Paint = function( self, w, h )
    draw.RoundedBox( 30, 0, 0, w, h, Color( 90, 90, 90, 200 ) )
    draw.SimpleText( "Админский ПивоХелп", "help", w / 2,  h / 2.0, Color( 224, 184, 128 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
end
    dPanelButton1.DoClick = function() 
        local dPanelDa = vgui.Create( 'DFrame') 

        dPanelDa:SetSize( 500, 300 )
        dPanelDa:SetPos( ScrW() / 2 - 450, ScrH() / 2 - 250)

        dPanelDa:SetTitle( ' Админский ПивоХелп ' )
        dPanelDa:ShowCloseButton( true )

        dPanelDa:MakePopup()

        dPanelDa.Paint = function( self, w, h )

        draw.RoundedBox( 5, 0, 0, w, h, Color(90, 90, 90, 200) )
        draw.RoundedBox( 5, 2, 2, w, 25, Color(224, 184, 128) ) 
end

end

timer.Simple( 1, function() PivoDerma() end ) -- потнич

end)

add some more details!add some more details!add some more detailsadd some more detailsadd some more detailsadd some more detailsadd some more detailsadd some more detailsadd some more detailsadd some more detailsadd some more details

Buba
  • 1

1 Answers1

0

You have an extra end) at the end of the code block. I assume that's line 127, right? That is, unless this code is inside a block that starts somewhere we can't see in your except.

Be sure to be careful with identation when writing function blocks! It helps to make sure your function() blocks are properly closed with a corresponding end.

One extra thing. This:

dPanelButton1.Paint = function( self, w, h )
  ...
end

Can instead be written as:

function dPanelButton1:Paint( w, h )
  -- the 'self' arg can be omitted by using colons ":" instead of dot "." during declaration and calls.
  -- this is the most common way of passing the table the function is stored in as the first argument, implicitly named `self`.
  -- In other words, calling `dPanelButton1:Paint(1, 2)` is the same as calling `dPanelButton1.Paint(dPanelButton1, 1, 2)`
  ...
end

And this:

dPanelButton1.DoClick = function()
  ...
end

Could be written as:

function dPanelButton1.DoClick()
  -- Writing `function foo(arg)` is the same as writing `foo = function(arg)`.
  ...
end

This makes the function blocks clearer in the code and is easier for others to read. Clean readable code is how you prevent syntax errors (well, that and an IDE).

akicat
  • 16
  • 6