Hey guys, so im working on a web browser script just to practice with lua and ive run into a problem.
I tried to make a back button but when i click on the button it gives me this error -
[ERROR] lua/webbrowser.lua:60: attempt to call method 'HTMLBack' (a nil value)
I looked at the gmod lua wiki and the method it showed for going to the previous page was Panel:HTMLBack(), yet it still give me this error
Here is my code for the main frame, html page, and the back button.
Code:
local Web = vgui.Create( "DFrame" )
Web:SetPos( 50, 50 )
Web:SetSize( ScrW() - 90, ScrH() - 90 )
Web:SetTitle( "Web Browser" )
Web:SetVisible( true )
Web:SetDraggable( true )
Web:ShowCloseButton( true )
Web:MakePopup()
HTMLTest = vgui.Create( "HTML", Web )
HTMLTest:SetPos( 25, 50 )
HTMLTest:SetSize(ScrW() - 125, ScrH() - 150 )
HTMLTest:OpenURL( HomePage )
BackButton = vgui.Create( "DButton", Web )
BackButton:SetSize( 50, 24 )
BackButton:SetPos( 24, 24 )
BackButton:SetText( "Back" )
BackButton.OnMousePressed = function()
HTMLTest:HTMLBack()
end
If anyone could help with this it would be much apprieciated.