Map generation help?

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
SniX
Prole
Posts: 24
Joined: Mon Aug 26, 2013 10:18 am

Map generation help?

Post by SniX »

So a quick one, for anyone who can help me,

Code: Select all

map1={}
for i = 1, 10 do
for h = 1, 10 do
map1[i][h] = 1
end
end
Why doesnt this work???
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Map generation help?

Post by davisdude »

I would need to know the error message (if any), but here's a guess:

Code: Select all

map1={}
for i = 1, 10 do
	map1[i] = {}
	for h = 1, 10 do
		map1[i][h] = 1
	end
end
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Map generation help?

Post by Jasoco »

Yes. That's correct. You weren't creating the nested table so it was trying to add to an item that's not a table itself.

Simple mistake.
SniX
Prole
Posts: 24
Joined: Mon Aug 26, 2013 10:18 am

Re: Map generation help?

Post by SniX »

Jasoco wrote:Yes. That's correct. You weren't creating the nested table so it was trying to add to an item that's not a table itself.

Simple mistake.
Thanks :awesome:
Post Reply

Who is online

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