title: Attempt to index global 'io' (a nil value)
body: <p>Before I explain my problem, I have already had a look around stack overflow and looked through countless questions regarding this error message.</p>
  
  <p>I have tasked myself with building an updating stats page on my website which updates itself with realtime stats from my Garry's Mod game server. I have written a lua script (which I will include below) that in theory should pull the current map name and number of players connected to seperate text files.</p>
  
  <p>Here is my program in it's current state (I have not added a loop for updating just yet, trying to get working in simplest form first):</p>
  
  <pre><code>// Custom script to pull current server statistics and return to website
  local current_map = game.GetMap()
  local current_players = #player.GetAll()
  map = io.open("../../../../map.txt", "w")
  map.write(current_map)
  map.close()
  players = io.open("../../../../players.txt", "w")
  players.write(current_players)
  players.close()
  </code></pre>
  
  <p>When I start up the server, I get an error in my console with <code>Line 4: attempt to index global 'io' (a nil value)</code></p>
  
  <p>After trying countless numbers of things and editing the code many times, I am still unable to get this working when it should in theory be so simple, and I have no idea what is wrong.</p>