Error With Object Oriented Things

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.
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Error With Object Oriented Things

Post by zorg »

Just a blind guess, but i think it may be the issue, you're not math.floor-ing the map (and emap) indexing code after you divide the grid coordinates with 32; usually it wouldn't be an issue, but double indexing errors out if you try to do [nil][anything], which you might be, given the previous reasoning. (it's not integer division, and you don't have fractional array values defined)

Math floor the self.grid / 32 expressions inside the []-s, and maybe it will work.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
pgimeno
Party member
Posts: 3550
Joined: Sun Oct 18, 2015 2:58 pm

Re: Error With Object Oriented Things

Post by pgimeno »

I forgot to specify, sometimes instead of [ ] it's the . operator the one producing the error (which is another notation for the same thing).

Also, what zorg said.

Also, Windows users normally don't think of using print() as a debugging tool, because they don't have a console to look at the output. Opening Löve from the console as a console application (is lovec.exe still a thing?) will allow you to view the output of print() commands, which are priceless for debugging and finding out what values are causing problems.
User avatar
NotARaptor
Citizen
Posts: 59
Joined: Thu Feb 22, 2018 3:15 pm

Re: Error With Object Oriented Things

Post by NotARaptor »

On Windows you can force a console to appear by editing the conf.lua file. Print is invaluable for debugging :)
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Error With Object Oriented Things

Post by zorg »

Both the conf.lua setting (and you should define your conf.lua-s as well!) and using lovec.exe is recommended! :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 204 guests