title: Creating new folders and files with Lua
body: <p>I'm writing a Lua 5.1 script for personal use, designed to be run as a stand-alone program through the Lua interpreter. I need to include a function that will create a new subfolder (where "mainfolder" contains the script and a folder titled "season", and the new folder is created as a subfolder of "season"), then write the text string returned by another function to a new text file within the new folder. This is on Windows 8. Since I'm not usually good at explaining things, here's some pseudo-code to illustrate:</p>
  
  <pre><code>function makeFiles()
      createfolder( ".\season\week1" )
      newFile = createFile( ".\season\week1\game.txt" )
      newFile:write( funcThatReturnsAString() )
      newFile:close()
  end
  </code></pre>
  
  <p>I know how to open and write to existing files in the same folder as the script, but what I cannot figure out is how to 1) create the subfolder, and 2) create a new file. How do I do this?</p>