Lua Help
This 'cheat sheet' is aimed at people that have a basic knowledge of programming. I'll start with some quick and obvious things that people may or may not know.

- The .lua files are plain text. Open them with a text editor (like Notepad).
- If you open in notepad and all of the text is on one line then use an editor like Notepad2 or BLua.
- All functions which call functions in the Source Engine start with the _ character.
- You don't have to add a ; at the end of every line - put it won't punish you for adding it.

As for the style of Lua.. Here's some common code to learn from.

- Defining a function

      function SayMyName( name )

           Msg( "Your Name Is " .. name )

      end

- Calling a function

      SayMyName( "garry" );

- Commenting

      -- Calling the function boss.
      SayMyName( "garry" );
      -- Called the function boss.

- If statement

      if ( name == "garry" ) then

           SayMyName( "garry" )

      end

      if ( name ~= "garry" ) then

           SayMyName( "NOT garry" )

      end

- For statement

      -- Loops i from 0 to 32
      for i=0, 32 do

          Msg( "Number " .. i )

      end

- Variables

      -- Locals only exist within the function in which they're defined
      -- If you don't declare a variable as local it will exist globally by default

      local name = "garry"

      -- Tables are like arrays, they must be declared like so

      PlayerNames = {}

      -- and then you can fill them up like so

      PlayerNames[0] = "david"
      PlayerNames[1] = "andrew"

      Msg( "Player 0's name is " .. PlayerNames[0] )

      -- The index doesn't have to be a number

      PlayerNames["test"] = "superdood";

      Msg( "Player's name is " .. PlayerNames["test"] )
      -- or
      Msg( "Player's name is " .. PlayerNames.test )

      -- Variables aren't a set type and can hold anything

      Players = {}

      Players[0] = {}
      Players[0].name = "Garry"
      Players[0].money = 1000
      Players[0].age = 32

      -- They can even hold functions since they're a legitimate variable type

      function SayHello( )

           Msg ( "Hello" )

      end

      Players[0].intro = SayHello

      Players[0].intro()

      -- which means you can also pass them to functions

      function SayPlayerHello ( in_function )

           in_function()

      end

      SayPlayerHello( Players[0].intro )

I probably went a bit complicated towards the end for the new guys. I just want to give you an idea of what to expect when you're looking at other people's code. I know what it's like to have big blanks in your programming knowledge.

Anyway, here's some useful Lua links:

- Lua's Homepage - not too useful, but you might want to visit.
- GMod Wiki - the Lua scripting section in the Garry's Mod Wiki.
- GMod Lua Forum - ask for help, give help, share your mods!

- TEAM GARRY