citizen:/scripting/resource_init.lua:17: unexpected symbol near ‘then’

You have many errors in your code, the error in the title is not the one the currently presents when you run this code.


First Error: :4: ')' expected near 'end'

line 4 is:

setmetatable(_G end

Should be

setmetatable(_G, {

The error is pretty unclear because this is a fairly odd mistake, i am not sure why that end was put there.


Second Error: :9: '}' expected (to close '{' at line 4) near 'if'

there is a misplaced end on line 8 that should be be on line 11. This error is expecting } because the end on line 8 completes the function definition started on line 6.


Third Error :18: unexpected symbol near 'then'

line 18 is:

if k:sub(-1) ==  then

should be something like:

if k:sub(-1) == "s" then

you need a second operand of the ==


Forth Error: :36: 'end' expected (to close 'function' at line 6) near '}'

missing end between lines 32 and 33. Pretty clear error on this one, it is worth stating the indentation ended up wonky and that can make seeing missing end‘s a bit more difficult

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top