Page 1 of 1

Map generation help?

Posted: Wed Feb 26, 2014 9:17 pm
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???

Re: Map generation help?

Posted: Wed Feb 26, 2014 9:23 pm
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

Re: Map generation help?

Posted: Wed Feb 26, 2014 9:44 pm
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.

Re: Map generation help?

Posted: Wed Feb 26, 2014 10:57 pm
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: