How can I most simply create a text file if it doesn't exist, then append a line of text, then close it?
I'm trying to create simple output to a textfile (for debugging purposes, mostly). I would like to have something like,
Code: Select all
i, emergencyBrake = 0, 10^10
while table.continue do
i = i +1
...
if i==emergencyBrake then debug:log("logfile.txt", "Loop went on too long, table contains "..debug:dump(table)); break end
end
Any help would be greatly appreciated!