Page 1 of 1

Syntax error in my tables

Posted: Fri Dec 13, 2013 4:16 pm
by subtledemise
On one of my tables, I get a syntax error when I try to test run my game. The error is as follows:
Image
The table in question looks like this:

Code: Select all

enemies = {
	bat = require "enemy/bat"
	bigworm = require "enemy/bigworm"
	eyeball = require "enemy/eyeball"
	ghost = require "enemy/ghost"
	flower = require "enemy/flower"
	pumpking = require "enemy/pumpking"
	slime = require "enemy/slime"
	smallworm = require "enemy/smallworm"
	snake = require "enemy/snake"
	}
Attached a .love also.

[]

Posted: Fri Dec 13, 2013 4:22 pm
by bekey
-snip-

Re: Syntax error in my tables

Posted: Fri Dec 13, 2013 4:26 pm
by subtledemise
Of course, I always miss the simplest things. Thanks so much! :)

Re: Syntax error in my tables

Posted: Fri Dec 13, 2013 4:43 pm
by subtledemise
Sorry to double post, but I have a new issue and don't want to make another thread for something that's also quite simple to solve that I'm just missing, but now I get an error saying
main.lua:36: attempt to index field 'slime' (a boolean value)

[]

Posted: Fri Dec 13, 2013 4:45 pm
by bekey
-snip-

Re: Syntax error in my tables

Posted: Fri Dec 13, 2013 10:35 pm
by Jasoco
bekey wrote:

Code: Select all

enemies = {
	bat = require "enemy/bat",
	bigworm = require "enemy/bigworm",
	eyeball = require "enemy/eyeball",
	ghost = require "enemy/ghost",
	flower = require "enemy/flower",
	pumpking = require "enemy/pumpking",
	slime = require "enemy/slime",
	smallworm = require "enemy/smallworm",
	snake = require "enemy/snake"
	}
notice the comma after every entry except last
The best part is Lua is flexible enough to not care if the last one has a comma too.