Lua save string to file
<p>I've started using Lua for school, and I'm wondering if it is possible to save a string to a txt file?</p>

<p>i.e</p>

<p>I have a string called <code>shroom</code> and it equals <code>mush</code>.</p>

<p>I have a file in the same folder as the .lua file called <code>output.txt</code>.</p>

<p>I now want to save the string <code>shroom</code> to <code>output.txt</code>.</p>

<p>I then want to make a while loop and every 1 second save the string <code>shroom</code> to the <code>output.txt</code> file, overwriting the contents of <code>output.txt</code> each time i save the string.</p>

<p>Is this possible in Lua? I've never used Lua before and I'm really confused at the moment..</p>

<p>Thanks :)</p>