Problem with Library

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
TheConfuZzledDude
Prole
Posts: 21
Joined: Fri Nov 02, 2012 10:23 pm

Problem with Library

Post by TheConfuZzledDude »

I'm in the middle of making a collision library for my game, and even before i've put in the collision detection, it's started giving me an error when I try to draw my polygon, spitting out "main.lua:39: attempt to index a nil value". I find this strange because I had tested it before and it seemed to be working, and I've compared it to other libs like hump.vector, and I don't see what is going wrong!

https://dl.dropboxusercontent.com/u/300 ... ision.love
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Problem with Library

Post by Ranguna259 »

You're doing:

Code: Select all

love.graphics.rectangle("fill", test.points[1][x], test.points[1][y], 50, 50 )
But the variables 'x' and 'y' aren't being defined so you are actually doing:

Code: Select all

love.graphics.rectangle("fill", test.points[1][nil], test.points[1][nil], 50, 50 )
and 'test.points[1][nil]' and 'test.points[1][nil]' are nil.
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest