Hello! I am having problems with the input/output files again.
My code: 
function save_file(path)
	local file1 = io.open(path, "w+")  --> open text.txt in documents directory to write
		for i=1,#scene_obj do 
		file1:write("("..scene.w.."#"..scene.h..")".."\r\n")
		end
		file1:close()                              --> close the file
end
And then I run this function : 
if check_touch(save_but)
then
	save_file("|R|output.txt")   
end
And I get the following error:
mainFunctions.lua:303: attempt to index local 'file1' (a nil value)
stack traceback:
	mainFunctions.lua:303: in function 'save_file'
	mainFunctions.lua:45: in function 
If I change the path to : "|D|output.txt" or "|T|output.txt" it works, but I want to save in the current folder where the game is.
"output.txt" doesn't work either.
What am I doing wrong?
I tried creating a file with the same name in the folder, but it seems that the file does not have to exist in order to be written.                
Comments
@hgy29 can tell if "Studio" api is availiable or not.