Problem with Files [Solved]

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
User avatar
Kingdaro
Party member
Posts: 395
Joined: Sun Jul 18, 2010 3:08 am

Problem with Files [Solved]

Post by Kingdaro »

This is code from my script:

Code: Select all

line 36 > names = love.filesystem.enumerate("Names/") --I'm not sure if I have to put it as just "Names" or "Names/" with a slash at the end, either way the error showed up.
line 37 > for i=1, #names do
line 38 > names[i]:open('r')
data = names[i]:read()
names[i]:close()
names[i] = data
end
Every time the same error comes up:
love 2010-08-20 09-15-23-14.png
love 2010-08-20 09-15-23-14.png (10.69 KiB) Viewed 1148 times
And I'm not sure how to fix it, I tried to follow the wiki's instructions on how to read a file, kinda got lost in some parts, but according to it I have to open the file for reading, get the data, and I had to assume that I have to close the file before opening another one, what am I doing wrong?
Last edited by Kingdaro on Fri Aug 20, 2010 1:46 pm, edited 1 time in total.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Problem with Files

Post by bartbes »

You're calling open on a string, not on a file object, take a look at newFile.
User avatar
Kingdaro
Party member
Posts: 395
Joined: Sun Jul 18, 2010 3:08 am

Re: Problem with Files

Post by Kingdaro »

I assumed that the "love.filesystem.enumerate()" function returned a table of files, but it returns a table of strings instead? ._.

Works, now, thanks!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Imnotaplayer and 204 guests