title: Need Lua Help. attempt to index field 'Config' (a nil value) Gmod13
body: <p>Having this error when I run my gamemode.   </p>
  
  <blockquote>
    <p>[ERROR]<br>
    gamemodes/rp/gamemode/<strong>cl_init.lua</strong>:910: attempt to index field 'Config' (a nil value)<br>
      1. unknown - gamemodes/rp/gamemode/<strong>cl_init.lua</strong>:910</p>
  </blockquote>
  
  <p><code>config</code> is a table, with index's such as <code>config["Run Speed"]</code> and the entire table is set globally equal to <strong>GM.Config</strong> in the <strong>sh_config.lua</strong> file.  Why is config not being registered as a value?  Must I include the config file into the cl_init file?  and if so, how?  Using the include()?</p>
  
  <pre><code>function GM:Think()
  if ( self.Config["Local Voice"] ) then             **--Referred line(910)**  
      for k, v in pairs( player.GetAll() ) do
          if ( hook.Call("PlayerCanVoice",GAMEMODE, v) ) then
              if ( v:IsMuted() ) then v:SetMuted(); end
          else
              if ( !v:IsMuted() ) then v:SetMuted(); end
          end
      end
  end
  
  -- Call the base class function.
  return self.BaseClass:Think();
  end
  </code></pre>
  
  <p>Edit     --   config table in sh_config.lua.  </p>
  
  <pre><code>local config = {};
  
     -- Command 
  config["Command Prefix"]            = "/"; -- The prefix that is used for chat commands.
  config["Maximum Notes"]             = 2; -- Maximum notes per player 
  config["Advert Cost"]               = 60; -- The money that it costs to advertise.
  
  config["Advert Timeout"]            = 150 -- How many seconds between adverts
  config["OOC Timeout"]               = 60 -- How many seconds between OOC messages
  config["Item Timer"]                = 7 -- How many seconds between item uses
  config["Item Timer (S)"]            = 20 -- How many seconds between specific item uses
  config["Note Fade Speed"]           = 12 -- How many minutes before nots disappear                                 
  
  -- Voice
  config["Local Voice"]               = true; -- Players can only hear a player's voice if they are near them.   This is the index being called which is creating an error.
  config["Talk Radius"]               = 256; -- The radius of each player that 
  --other players have to be in to hear them talk (units).
  
  -- Player Stuff
  
   config["Walk Speed"]               = 150; -- The speed that players walk at.
   config["Run Speed"]                    = 275; -- The speed that players run at.
  
  
  GM.Config = config;
  </code></pre>
  
  <p>I have                                  <code>includecs("sh_config.lua");</code> in sh_init.lua. <code>include("sh_config.lua")</code> and <code>AddCSLuaFile("sh_config.lua")</code> in init.lua. and <code>include("sh_config.lua");</code> in cl_init.lua. </p>
  
  <p>Im still getting this stupid error though.  Can someone explain what the difference between including and Addcs'ing a file does.  How do I make sh_config's variables global in other files?  Or in other words how do I make the desired file(cl_init) read through the code in sh_config.lua and I can use code from it in the client side init?</p>