A long needed post about Lua

lua_logo

Lua is a scripting language created in Brazil, more specifically in the (Pontifícia Universidaded Católica do Rio, PUC-RIO).

Quoting their own website: “Lua is a powerful, fast, lightweight, embeddable scripting language.” Which is pretty accurate in my opinion, and probably in the opinion of everyone that works with it in a daily basis.

More importantly though, is that Lua is widely used as a scripting language in games. A lot of major companies use it, and a lot of well known games have published games using LUA. I worked in Fable 2 which is one of them, and I carry on working with it in Fable 3.

Two very important features of Lua in my opinion are the flexible variables, a Lua variable can take anything, integers, floats, strings, tables, enums, and their type can change on the fly so

if a == 1 then
a = ”I changed the variable to contain this string”
end

is perfectly valid.

The other one, and probably the most important feature of Lua are tables. Tables are a way of storing data, much like an Array, but a lot more powerful.

Tables are a sequence of Lua variables, so each entry of the table can contain a different type, and even other tables. And this is just amazing. After you used Lua tables you start wondering why the hell no other language has a feature like this.

I use C# for my XNA personal projects, and I was thinking about implementing a Lua style tables into it just because I miss it so much when I’m using C#.

Of course, these are just a couple of cool things about Lua, there are a ton more.

You can Download Lua here.

WordPress Themes