FishofMuu wrote:Okay, I KNEW it was something stupidly easy like that. I'm totally new to LUA this week, so I've never even seen \r before. Thank you.
That's actually a Windows idiosyncrasy, IIRC. In OS X or any *NIX system, \n will do exactly what you expect it to. It's only in Windows that you have to do \r\n.
The following code works just fine on my windows XP and windows 7 machines, newlines behave exactly how the *nix user in me expects. (Pruned somewhat for readability.)
function saveOptions()
local set = ""
set = set .. "-- Save File\n"
set = set .. "-- Created on " .. os.date("%c") .. "\n\n"
local file = love.filesystem.newFile("settings.lua")
file:open('w')
file:write(set)
file:close()
end
bartbes wrote:You're both wrong and right. It depends on the editor you open it in. Notepad needs \r\n, but wordpad for example works with just \n as well.
Oh, I thought he was printing it to the console to test, not viewing in Notepad...
bartbes wrote:You're both wrong and right. It depends on the editor you open it in. Notepad needs \r\n, but wordpad for example works with just \n as well.
Ooooooh, alright. That makes a bit more sense now. Was pulling my hair out over something so simple. I code in Notepad++, but I open random txt files in notepad.