Weird syntax error[ SOLVED ]

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
User avatar
Casfew
Prole
Posts: 2
Joined: Fri Dec 31, 2021 12:59 am

Weird syntax error[ SOLVED ]

Post by Casfew »

Hi!! :DDD

Im a begginer at programming and trying to recreate Space Invader in Löve for Android. But im getting a syntax error that i can't quite understand why im getting it:

Error

Syntax error: bullet.lua:74: 'end' expected (to close 'function' at line 48) near '<eof>'

Traceback

[C]: at 0x97533909
[C]: in function 'require'
main.lua:15: in function 'load'
[C]: in function 'xpcall'
[C]: in function 'xpcall'

It happens in a function that is supposed to handle the player's bullets, the player is supposed to have 5 bullets that he can shoot when they're not already on the screen.
Space_invaders.love
Files of the game
(76.57 KiB) Downloaded 61 times
I'd very thankful if anyone can help me with this, have a good day :))
Last edited by Casfew on Wed Jan 12, 2022 5:13 am, edited 1 time in total.
User avatar
BrotSagtMist
Party member
Posts: 657
Joined: Fri Aug 06, 2021 10:30 pm

Re: Weird syntax error

Post by BrotSagtMist »

You are not closing the for loops at line 29 and 50 in bullets.lua with an _end_.
Be more careful with indents or get an editor which automatically checks for open blocks.
When you properly indent the block in the for loop you end up seeing a gap underneath, that way coders see where ends are missing.

Fixing another thing, that bullet self thingy is a nil value which you can bypass with _or_ , i get it to at least show the graphics. Looks chaotic tho.
obey
User avatar
Casfew
Prole
Posts: 2
Joined: Fri Dec 31, 2021 12:59 am

Re: Weird syntax error

Post by Casfew »

Thx so much now it's fixed :D

The self thingy was a typing error and the resolution diference probably was what messed up the graphics.
Post Reply

Who is online

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