Getting Started With Lua

From GMod Wiki

Revision as of 18:45, 22 August 2011 by Barkly (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Notepad-48.png Note: It's a good idea for you to read through the overview Page first if you haven't already.


It is recommended you view the overview page first, for some basic information on lua.

This page is mainly about installing a script editor for creating lua scripts. If you have already chosen and installed a script editor, then you should start to read the tutorials.

Where Do I Start?

First of all, you will need to get a script editor for lua.
As lua code is typed in english and not compiled (coverted to computer code) when creating scripts, you only need a simple text editor such as notepad.

However, for features such as syntax highlighting (colouring different parts of the code different colours), you will need to install a script editor such as Notepad++ Or sciTE( [1] )

Notepad++ is a popular text-editing program within the Lua coding community, due to it being open source and extremly flexible when adding new syntax highlighting. It also allows you to change the colour, formatting style, and font style of the whole text-editor to make it a much more comfortable environment for you to work in.

Post-Installation

When you have successfully installed it, and have launched it, you should be greeted by this

Notepad 01.png


First thing you will notice, that if you type any lua syntax, it will not be highlighted, to fix this go to Plugins >> Plugin Manager >> Show Plugin Manager and find the following Syntax Highlighter in the "Available" tab and click 'Install'

Notepad 02.png


This smaller window will be shown during installation

Notepad 03.png


After the installation of the Gmod Lua syntax highlighter is complete, you need to go to Settings >> Preferences >> New Document/Default File Directory and set the Default Language to "Gmod Lua", after that, just click close (Making sure Gmod Lua has been selected)

Notepad 04.png


Now you're ready to code Your First Scripted Weapon.

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox