table not visible?

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
vschiavoni
Prole
Posts: 6
Joined: Tue Jul 06, 2010 1:32 pm

table not visible?

Post by vschiavoni »

Hello
im getting started with LOVE. I did a simple script that is supposed to draw 10 circles at random positions on the scree.
I initialize the coordinates in load.love(), and I try to draw them in load.love() .

When I run the app, the window and the background are displayed, but not circles.
What am I doing wrong?

Code: Select all

peers={}
function love.load()
	love.graphics.setBackgroundColor( 2, 60, 80 )
	for i,v in ipairs(peers) do
		local x = math.random(1024)
		local y = math.random(768)
		peers[i] = {x,y}
	end	
end
function love.draw()
	for _,p in pairs(peers) do
	 	 love.graphics.circle("line", p[1], p[2], 10, 100) 
	end
end
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: table not visible?

Post by bartbes »

Ehm, how is the table supposed to be filled?
ipairs loops over the existing entries in the table, these don't exist so the loop simply never runs.
vschiavoni
Prole
Posts: 6
Joined: Tue Jul 06, 2010 1:32 pm

Re: table not visible?

Post by vschiavoni »

The table is filled in the love.load(). See the code i've posted this line:

Code: Select all

peers[i] = {x,y}
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: table not visible?

Post by bartbes »

No it is not, look at the loop again.
vschiavoni
Prole
Posts: 6
Joined: Tue Jul 06, 2010 1:32 pm

Re: table not visible?

Post by vschiavoni »

you're right..i really need one more pair of eyes..

:brows:
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests