function arguments expected near '='

This is probably extremely simple, and I’m looking for solutions.
This is my first attempt at lua, so please don’t be too harsh.
I’ve also probably made this really messy trying to fix the error.


local AnnounceButton = vgui.Create("DColorButton", SVFrame)
AnnounceButton:SetPos(5, 5)
AnnounceButton:SetSize(100, 60)
AnnounceButton:SetText("Announce")
AnnounceButton:SetColor(Color(255, 111, 0, 255))
AnnounceButton:SetContentAlignment(5)
AnnounceButton:SetTextColor(Color(255, 255, 255))

AnnounceButton.DoClick = function()
    local AnnounceCheckBox = vgui.Create("DCheckBox")
    AnnounceCheckBox:SetParent(DPanel)
    AnnounceCheckBox:SetPos(25, 25)
    AnnounceCheckBox:SetText("Announce changes to all players?")
    AnnounceCheckBox:SetConVar("svcheater_announce")
    AnnounceCheckBox:GetConVar("svcheater_announce")
    svcheater_announce:GetInt = function(integer) -- function arguments expected near '='  NOTE: Originally I just used function() and instead of "if integer = 1 then" it was "if svcheater_announce = 1 then" but that delivered an error akin to "expecting function arguments"
		if integer = 1 then
			AnnounceCheckBox:SetValue(0)
		else
			AnnounceCheckBox:SetValue(1)
		AnnounceCheckBox:DoClick() = function()

			if integer then
				svcheater_announce:SetInt(1)
			else
				svcheater_announce:SetInt(0)
			end
		end
	end
end



svcheater_announce:GetInt = function(integer)

should be


svcheater_announce.GetInt = function(integer)

or


function svcheater_announce:GetInt(integer)

Upon doing either of those


AnnounceButton.DoClick = function()
    local AnnounceCheckBox = vgui.Create("DCheckBox")
    AnnounceCheckBox:SetParent(DPanel)
    AnnounceCheckBox:SetPos(25, 25)
    AnnounceCheckBox:SetText("Announce changes to all players?")
    AnnounceCheckBox:SetConVar("svcheater_announce")
    AnnounceCheckBox:GetConVar("svcheater_announce")
    svcheater_announce.GetInt = function(integer)
		if integer = 1 then
			AnnounceCheckBox:SetValue(0)
		else
			AnnounceCheckBox:SetValue(1)
		AnnounceCheckBox:DoClick() = function()

			if integer then
				svcheater_announce:SetInt(1)
			else
				svcheater_announce:SetInt(0)
			end
		end
	end
end

or


AnnounceButton.DoClick = function()
    local AnnounceCheckBox = vgui.Create("DCheckBox")
    AnnounceCheckBox:SetParent(DPanel)
    AnnounceCheckBox:SetPos(25, 25)
    AnnounceCheckBox:SetText("Announce changes to all players?")
    AnnounceCheckBox:SetConVar("svcheater_announce")
    AnnounceCheckBox:GetConVar("svcheater_announce")
    svcheater_announce.GetInt = function(integer)
		if integer = 1 then
			AnnounceCheckBox:SetValue(0)
		else
			AnnounceCheckBox:SetValue(1)
		AnnounceCheckBox:DoClick() = function()

			if integer then
				svcheater_announce:SetInt(1)
			else
				svcheater_announce:SetInt(0)
			end
		end
	end
end

Console expects ‘then’ after ‘=’ at this line:


if integer = 1 then

And glualint says “unexpected = expection function call or indexation”

I can’t belive that I… Anyways, I did what you suggested, then corrected that. I then had to do the same thing with the


AnnounceCheckBox:DoClick

thanks! Now to work on other errors. Closing!