read textfile and save in a multidimensional table

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
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: read textfile and save in a multidimensional table

Post by kikito »

Just in case you are still stuck:

https://github.com/kikito/love-tile-tutorial/wiki
When I write def I mean function.
nadula
Prole
Posts: 10
Joined: Wed Sep 25, 2013 8:23 am

Re: read textfile and save in a multidimensional table

Post by nadula »

Hi,
thank you all for the big help. It works and that's the code

Code: Select all

map={}
	k=1
	v=1
    for line in love.filesystem.lines("labyrinth1.txt") do
	map[k] = {}
	for i in string.gmatch(line,"%S+") do
	map[k][v] = tonumber(i)
	v= v+1
	end
	k= k+1
	v=1
	end
Post Reply

Who is online

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