Lua: Introduction and Setup

Lua, the Portuguese for 'moon', is a "powerful, fast, lightweight, embeddable scripting language". It's used in a hell of a lot of things (often for extendibility), including:

Lua is a scripting language - this means Lua is interpreted as it runs rather than being "compiled" into something raw that the computer can understand before-hand like some other languages (e.g. C++). This means that if you're giving a Lua creation to a friend or colleague, you'd simply give them the '.lua' file itself and let them interpret/run it on their machine.

It's worth noting that a Lua is also very customizable and flexible - this is why some of the people that are following these tutorials for something like game creation will not only have to learn the core language of Lua, which is what this series is for, but also special hooks and functions and things that are specific to what they're coding for.

If you don't actually want to test your code by getting it interpreted and seeing any output then you can code Lua using pretty much any text editor out there (Notepad++, Sublime Text, Nano, etc.) - you simply have to save your code as a '.lua' file. The chances are of course that you do want to see the output of your code to see how it performs and what it does, as well as checking that it doesn't have any errors. For this, the easiest path to go down is to use an Integrated Development Environment

If you're using Windows, you can get the Lua programming language and a nice IDE for Lua called SciTE in this package here: http://luaforwindows.luaforge.net/ and if your using another operating system (for example Mac OS X or Linux) then you can check for installation instructions on any of the many resources available online. For Mac and Linux systems it should be as simple as downloading the precompiled executables for your system here here, and then wiring up some kind of text editor to compile it, or compiling via the executables via Terminal (put the appropriate executable in your 'bin' folder - Google if you're not quite sure what to do).

For these set of tutorials I'm going to assume that everyone knows their development environment, whether this be an easy-to-use IDE like SciTE (pronounced "skite" by the way), or something a little more complex. Now you have your Lua scripting environment set up, you're ready to write some Lua! If you're using an IDE you simply need to whip it open, write some code, and then hit an appropriately labelled 'Run' button, and if you're using a more custom setup, you should probably know the way you set it up. Now we just need to know how to write the code...