Syntax error in my tables

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
subtledemise
Prole
Posts: 6
Joined: Tue Dec 10, 2013 1:34 am

Syntax error in my tables

Post 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.
Attachments
aRPG.love
(93.98 KiB) Downloaded 74 times
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Last edited by bekey on Fri Jan 24, 2014 1:56 am, edited 1 time in total.
love2d.org forum removal spell: http://pastebin.com/iVqJrbKN
subtledemise
Prole
Posts: 6
Joined: Tue Dec 10, 2013 1:34 am

Re: Syntax error in my tables

Post by subtledemise »

Of course, I always miss the simplest things. Thanks so much! :)
subtledemise
Prole
Posts: 6
Joined: Tue Dec 10, 2013 1:34 am

Re: Syntax error in my tables

Post 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)
bekey
Party member
Posts: 255
Joined: Tue Sep 03, 2013 6:27 pm

[]

Post by bekey »

-snip-
Last edited by bekey on Fri Jan 24, 2014 1:56 am, edited 1 time in total.
love2d.org forum removal spell: http://pastebin.com/iVqJrbKN
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Syntax error in my tables

Post 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.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests