[Problem] Love.filesystem.enumerate() doesnt work!

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
rickydaan
Prole
Posts: 4
Joined: Tue Mar 20, 2012 5:04 pm

[Problem] Love.filesystem.enumerate() doesnt work!

Post by rickydaan »

Hey, I just started on a filesystem program, and i alreaddy have a problem;

I get this error:

Traceback:
[C]: In function Enumerate
main.lua:8 in function 'draw'
[C]: in function 'XPcall'

Main.lua is my online file, and config.lua (Wich is basic)

Code: Select all

function love.load()
end

function love.draw()
dirWorking = love.filesystem.getWorkingDirectory()
love.graphics.print(dirWorking, 100,100)

files = love.filesystem.enumerate()
print(files)
end

function love.update(dt)
end

function love.focus(bool)
end

function love.keypressed( key, unicode )
end

function love.keyreleased( key, unicode )
	
end

function love.mousepressed( x, y, button )
end

function love.mousereleased( x, y, button )
end

function love.quit()
end
User avatar
trubblegum
Party member
Posts: 192
Joined: Wed Feb 22, 2012 10:40 pm

Re: [Problem] Love.filesystem.enumerate() doesnt work!

Post by trubblegum »

https://love2d.org/wiki/love.filesystem.enumerateI don't see anywhere that an argument is optional.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: [Problem] Love.filesystem.enumerate() doesnt work!

Post by Robin »

Try this:

Code: Select all

function love.load()
	files = love.filesystem.enumerate('')
end

function love.draw()
	dirWorking = love.filesystem.getWorkingDirectory()
	love.graphics.print(dirWorking, 10,10)

	for i, file in ipairs(files) do
		love.graphics.print(file, 10, 30 * i)
	end
end
Do you see the difference?
Help us help you: attach a .love.
rickydaan
Prole
Posts: 4
Joined: Tue Mar 20, 2012 5:04 pm

Re: [Problem] Love.filesystem.enumerate() doesnt work!

Post by rickydaan »

Ooh, It needed strings >.<

Thanks for the help!

And how to use the read() function, as it says:
Calling global read() at line xxx
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: [Problem] Love.filesystem.enumerate() doesnt work!

Post by Robin »

Code: Select all

   for i, file in ipairs(files) do
      -- do something with:
      love.filesystem.read(file)
   end
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot] and 1 guest