Reputation: 25
Well, the name is self explanatory. I don't know how to go along with it and I don't want to risk breaking the script by deleting the file and replacing it.
Can anyone post a method I could use? I tried searching around and so far no luck.
Upvotes: 2
Views: 3576
Reputation: 3390
Posting Egor Skriptunoff's comment as an answer.
Use
io.open(filename,"w"):close()
where filename
is the name of the file you want to clear. This will open the file for writing and immediately close the file, discarding its contents.
Upvotes: 4