Programming & Scripting Tutorials

Lua: Introducing and Setting Up Lua

Lua (Portugese for ‘moon’) is a “powerful, fast, lightweight, embeddable scripting language”. It’s used in a hell of a lot of things (often for extendability) including:



Because it’s a scripting language, Lua is interpreted by an application at run-time rather than being compiler before-hand (so if your giving a Lua creation of yours to a friend – you’d simply give them the .lua file).
It’s worth noting that a Lua is also very customizable – this is why that the people that are following these tutorials for something like game creation will have to not only learn the actual core language of Lua (which this website teaches), but also special hooks and functions and things that are individual to what they’re coding for.

If you’ve done any programming before – it’s worth noting that Lua is a lot like many other languages in quite a few aspects, but it isn’t a language in which you need semi-colons to end lines. Some people like using semi-colons in Lua, but this is simply to keep their code tidy (Lua just ignores the semi-colons).

So let’s actually get things setup!



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! 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).

If your using Windows, you can get the Lua programming language and a nice text editor for Lua (called SciTE) in this package here: http://luaforwindows.luaforge.net/

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 sources available online. It’s usually as simply as downloading and installing Lua from here: http://www.lua.org/download.html
And then (optionally) downloading and installing SciTE here: http://www.scintilla.org/SciTEDownload.html
Now you have your Lua scripting environment setup (for these set of tutorials I’m going to assume that everyone is using SciTE since it makes testing your scripts very easy) – your ready to write some Lua! Simply create a new file with the ‘.lua’ extension in SciTE, write your code (we’ll work on this bit in the future tutorials!), and then click “Run Program” to test it!

This Lua tutorial was written by


Back to Lua

Advertisement: