General > Developers Corner

The World of Lua

(1/1)

Tommo1590:
So ive decided to TRY and teach myself Lua with the help of Garrysmod Wiki...
My first little project so to speak is to make a form of MOTD with tabs and im posting here because of well i hate facepunch, its full of people with non-helpful comments but yea ive started making this motd and got a error already lol... its:


--- Code: --- [lua\autorun\motd.lua:3] attempt to index global 'vgui' (a nil value)
--- End code ---

and the code im using is:

--- Code: ---function testpanel()

local DermaMOTD = vgui.Create("Frame")
DermaMOTD:SetTitle( "Welcome to blah blah blah" )
DermaMOTD:SetPos( 50,50 )
DermaMOTD:SetSize( 500, 500 )
DermaMOTD:SetVisible( true )
DermaMOTD:SetBackgroundBlur( true )
DermaMOTD:SetDraggable( true )
DermaMOTD:ShowCloseButton( true )

DermaMOTD:MakePopup()

end

concommand.Add("testmenu", testpanel)
--- End code ---

now i dont see how this can be making a error as it is just from the garrysmod wiki but can anyone help please???

Edit:
I have changed the way the function works and it seems to have fixed it, just shows how Wiki have to much wrong information  ;D

Megiddo:
Glad that we were able to, erm, help you! Just let us know if you have any other questions. :)

Navigation

[0] Message Index

Go to full version