Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
io.open() file:write() doesnt work — Gideros Forum

io.open() file:write() doesnt work

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:close() --> close the file

And then I run this function :
if check_touch(save_but)

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.


Sign In or Register to comment.