Code: Select all
local f = assert(io.open("Test.txt", "r"))
print(f:read("*all"))
f:close()
f = assert(io.open("Test.txt", "w"))
f:write("New Stuff")
f:close()
I can read information from a text file easily, but when I overwrite the same file it does something weird.
The file in the working directory stays the same, unchanged, but the program is now reading the data of which I saved previously. I tried this using both the Love filesystem and Lua's but both have the same problem.
How do I make it modify the text file in the directory directly?
Sorry, but I'm new to both Lua and Love and I couldn't find a similar problem anywhere.