lua\test.lua:10: 'then' expected near '='

line 10 to 11:

  if test = "1" then 
  if !ply:IsAdmin() then return end

What do I have to do to fix this? I can’t figure it out. :bang:

Needs to be ==

= sets a value, == checks a value.

Oh dear, I completely forgot, I’ve even put == in my code further down :expressionless:


Now I get

lua\includes\modules\concommand.lua:36: bad argument #1 to 'lower' (string expected, got nil)

EDIT: I’m trying to check a variable and if it’s “1” check another and if that’s “1” stop the code completely.
EDIT 2: Oh and I’m using concommand to add the variables

function testoff()
 test = "0"
concommand.Add( test_off, testoff )

concommand.Add( test_off, testoff )

concommand.Add needs quotes, like:

concommand.Add( "test_off", testoff )

That will fix the error you posted above.

Wow, all the examples I saw never had them, oh well I guess I was looking at them wrong.

Thanks a lot guys.



but yea, it needs quotation marks, cause it’s thaT text you have to enter in your console, and then what the function’s name is.

Well, the few examples I did see. (from a friend :>)

Then you shouldn’t listen to him anymore.

He said he hasn’t done anything for gmod in a while.
Anyone can forget them anyway.

The errors I made in this thread were stupid.

I would consult the **[Garry’s Mod Wiki](** in the future, they have a lot of great examples and documentation.