Problem with love.filesystem

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
brianIcke
Prole
Posts: 2
Joined: Mon Apr 04, 2016 4:52 pm

Problem with love.filesystem

Post by brianIcke »

Hi,

i try to write a string into a txt file with love.filesystem:

Code: Select all

function love.load()
	file = love.filesystem.newFile("cool.txt")
	file:open("w")

	for x = 1, 5 do file:write("This is cool line number "..x) end

	file:close()

end

function love.draw()
	love.graphics.print("Done!", 0, 10)
end
My Problem is that this won't work, the txt file is still empty.

What is wrong with this code?

I hope you can help me.

Brian
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Problem with love.filesystem

Post by s-ol »

What operating system do you run and where are you looking for the file? It will be in AppData/love/gamename on Windows.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
brianIcke
Prole
Posts: 2
Joined: Mon Apr 04, 2016 4:52 pm

Re: Problem with love.filesystem

Post by brianIcke »

It work! I din't know, that Löve is saving the files in Appdata.

Thanks!

Brian
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests