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.

3 Comments

  • By Zach Aikman, November 11, 2009 @ 11:31 pm

    I'm just curious, did you ever manage to get this working? I'm stumbling onto the same problem myself for a side-project I'm working on involving Lua, C# and named pipes for some inter-process communication. Having some sort of Lua table equivalent in C# land would make some things *so* much easier.

  • By Hulshof, November 25, 2009 @ 10:33 am

    I never actually started writing the class, but it's certainly on my list of to do things when I get time :)

Other Links to this Post

  1. SIDNEY — July 5, 2010 @ 8:46 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

WordPress Themes