Reading and writing
Posted: Wed Apr 18, 2012 10:12 am
How would one go about reading and writing to text files with love?
I see the functions are there, but I don't know how to use them. How would I use those functions?Roland_Yonaba wrote:In pure Lua, you should have IO library... Working with löve, ou should take a look at love.filesystem. All functions you do need to perform what you want are packed in that table.
Is it really more work to click a link than it is to write a forum post asking someone else to do it for you?Delibrete wrote:I see the functions are there, but I don't know how to use them. How would I use those functions?Roland_Yonaba wrote:In pure Lua, you should have IO library... Working with löve, ou should take a look at love.filesystem. All functions you do need to perform what you want are packed in that table.
Well I've been trying for a few days now to read and write to text files, but it's ok now I've figured it out. But you're right, programming is probably not for me.trubblegum wrote:Is it really more work to click a link than it is to write a forum post asking someone else to do it for you?Delibrete wrote:I see the functions are there, but I don't know how to use them. How would I use those functions?Roland_Yonaba wrote:In pure Lua, you should have IO library... Working with löve, ou should take a look at love.filesystem. All functions you do need to perform what you want are packed in that table.
If your attention span is so short that you didn't get as far as the example code at the top of the page in the docs, then programming is not for you.
I've been trying for years to become a programmer and a designer, hopefully I'll get there eventually. Thanks mantrubblegum wrote:No worries .. some people are programmers, others are designers, and yet others are taxidermists.
But Rome wasn't built in a day, so don't give up just yet
Code: Select all
function love.load()
text= love.filesystem.newFile( 'text.txt' )
end
function love.keypressed(key,unicode)
if key == "space" then
txt:open('w')
txt:write("hello text file!")
end
end
Code: Select all
if key == "space" then
Code: Select all
if key == " " then
Code: Select all
txt:open('w')
txt:write("hello text file!")
Code: Select all
text:open('w')
text:write("hello text file!")