I'm struggling with a permission error in Lua when trying to read/write from/to a text file. As you can see below, I've pulled the error message from the io.open function and I'm getting "file.txt: permission denied". If it helps at all, I'm using Mac OSX Yosemite and the Love2D engine.
function fileWrite()
outputFile, error = io.open("new.txt", "w")
if outputFile then
for k,v in pairs(clicks) do
outputFile:write(tostring(v[1]) .. "," .. tostring(v[2]) .. "\n")
end
outputFile:close()
else
errorText = error
end
end
Am I making a silly error somewhere by any chance? I've dealt with writing to files in Lua before (on Windows 7), and I've never had this problem before.
Any feedback would be greatly appreciated! :)