Hi.
I have been learning how to code in Lua lately. Yesterday I was making an addon for Garrys Mod. Right now its just a few VGUI components, but it will be much more then that when I'm finished developing it.
Anyway, everything was going fine with the addon last night. I typed: "testMod" which is the console command to execute a method in my addon, and it worked fine. But after a while, the addon stopped working and now it wont recognise my addons console command anymore (I dont think its even loading my addon).
This is the error I get when I make a single player game (thats what I used to test my addon):
Lua initialized (Lua 5.1)
LuaGetfile: Not Loading autorun/
Couldn't include file 'autorun/' (File not found) (<nowhere>)
[lua/autorun/client/motd.lua:53] unexpected symbol near ')'
Registering gamemode 'sandbox' derived from 'base'
Any ideas?
I have tried completely clearing my lua file of everything and just putting in "print("test");" even that didnt work.
Also:
Any ideas on how to make this into an addon? Im struggling on the server/client side of things with VGUI. Any help would be much appreciated.
- Vancar6
Post code. Also:
[QUOTE=Vancar6;35354495]
[lua/autorun/client/motd.lua:53] unexpected symbol near ')'[/QUOTE]
Forgot to mention, it does this with any lua file thats there.
Motd.lua is a working file. Gmod just isnt playing nice with it.
Heres the code:
[code]
--[[
////////////////////////////////////////
////// MOTD Menu by JohnnyThunders//////
////////////////////////////////////////
--]]
function OpenMOTDMenu()
local MenuFrame = vgui.Create("DFrame")
MenuFrame:SetSize(ScrW() * 0.95, ScrH() * 0.95)
MenuFrame:SetPos((ScrW() - MenuFrame:GetWide()) / 2, (ScrH() - MenuFrame:GetTall()) / 2)
MenuFrame:SetTitle("Welcome to " .. GetHostName())
MenuFrame:SetVisible(true)
MenuFrame:SetDraggable(true)
MenuFrame:ShowCloseButton(true)
MenuFrame:MakePopup()
local MenuPSheet = vgui.Create("DPropertySheet")
MenuPSheet:SetParent(MenuFrame)
MenuPSheet:SetPos(13, 30)
MenuPSheet:SetSize(MenuFrame:GetWide() - 25, MenuFrame:GetTall() - 42)
local MOTD = vgui.Create( "HTML", MenuFrame )
MOTD:SetPos( 25, 50 )
MOTD:SetSize( 250, 250 )
MOTD:SetHTML() --use this for custom html code
--MOTD:OpenURL("") --or this if you want to open an URL, remember that you must pick only one, so comment out the function that you're not using
local Rules = vgui.Create( "HTML", MenuFrame )
Rules:SetPos( 25, 50 )
Rules:SetSize( 250, 250 )
Rules:SetHTML() --use this for custom html code
--Rules:OpenURL("") --or this if you want to open an URL, remember that you must pick only one, so comment out the function that you're not using
local AdminList = vgui.Create( "HTML", MenuFrame )
AdminList:SetPos( 25, 50 )
AdminList:SetSize( 250, 250 )
AdminList:SetHTML() --use this for custom html code
--AdminList:OpenURL("") --or this if you want to open an URL, remember that you must pick only one, so comment out the function that you're not using
local GroupPage = vgui.Create("HTML")
GroupPage:SetParent(MenuPSheet)
GroupPage:SetPos( 25, 50 )
GroupPage:SetSize( 250, 250 )
--GroupPage:SetHTML([[]]) --use this for custom html code
GroupPage:OpenURL("") --or this if you want to open an URL, remember that you must pick only one, so comment out the function that you're not using
--[[If you want to add another tab, simply paste this code
local ExampleName = vgui.Create("HTML")
ExampleName:SetParent(MenuPSheet)
ExampleName:SetPos( 25, 50 )
ExampleName:SetSize( 250, 250 )
--ExampleName:SetHTML([[]]) --use this for custom html code
ExampleName:OpenURL("") --or this if you want to open an URL, remember that you must pick only one, so comment out the function that you're not using
ExampleName is the name that identifies your new tab, you use it to refer to it when you add the tabs
ADD NEW TABS DOWN THERE!
--]]
local order = {}
--[[changing the numbers there will change the order of how the tabs are shown
if you want to add a new tab simply add
order[numindex] = {"TabName", ExampleVar", "path/to/icon", false, false, "tab description"}
--]]
order[1] = {"Group Page", GroupPage, "gui/silkicons/group", false, false, "Group page here"}
order[2] = {"Rules", Rules, "gui/silkicons/exclamation", false, false, "Rules are listed here"}
order[3] = {"MOTD", MOTD, "gui/silkicons/page", false, false, "Message of the day"}
order[4] = {"Admin List", AdminList, "gui/silkicons/shield", false, false, "Admins are listed here"}
for _, tab in pairs(order) do
MenuPSheet:AddSheet(unpack(tab))
end
end
concommand.Add("showmotdmenu", OpenMOTDMenu)
[/code]
THats not mine by the way, I just put that there to see if lua/autorun would work.