title: Why attempt to index global (a nil value) Lua?
body: <p>Actually I'm working from a tutorial and there is some error in that tutorial. </p>
  
  <p>There is the code:</p>
  
  <pre><code>class "Game"( Graphics )
  
  Game.menuScreen  = nil
  Game.gameScreen  = nil
  Game.achScreen   = nil
  Game.screen      = nil
  
  -- main
  function Game:main()
      -- Create the screens and store their links within the class
      Game.menuScreen  = MainMenu.new()
      Game.gameScreen  = GameScreen.new()
      Game.achScreen   = AchScreen.new()
  
      -- Display menuScreen
      Game.showScreen( 'menuScreen' )
  end
  
  -- showScreen
  function Game.showScreen( name )
      -- If a screen is being displayed - remove it from the stage
      if Game.screen then
          Stage.detach( Game.screen )
          Game.screen = nil
      end
  
      -- Retrieve a screen link by name
      local screen = Game[name]
      if not screen then
          return nil
      end
  
      -- If the screen is found - add it to the stage
      Stage.attach( screen )
      -- Save the displayed screen
      Game.screen = screen
  
      return screen
  end
  </code></pre>
  
  <p>It write to me [string "Game.script"]:11: attempt to index global 'MainMenu' (a nil value)
  I use Dreemchest Composer and this one is the tutirul: <a href="http://dreemchest.com/doc/en/Game%20menu%20and%20screen.html" rel="nofollow">http://dreemchest.com/doc/en/Game%20menu%20and%20screen.html</a></p>
  
  <p>Actually I remowed the LEVEL select screen from this code, cos I don't want to implement a level selection to my first game in this.</p>
  
  <p>I have a script named MainMenu and it's class's MainMenu, Superclass is soMainMenu.</p>