Fang Talks

She shoots bananas!

And no, I’m not even going to talk about LÖVE today!

Lau’s great. Just plain great. For those of you not in the know, it’s best described as a scripting language. Lightweight, easy and fun to use, and with a huge amount of possibilities. It’s often used as a scripting language to extend the user’s programming language of choice (but it’s also been put into scripting languages). I myself got introduced to it through LÖVE (last time I’ll mention that this post), and am currently diving a bit deeper into the language itself.

Doing so has taught me a lot of fun small things I wouldn’t have known otherwise. Some pretty essential things as well. My blog isn’t the place to get into specifics, but swapping variable values is hella easy, functions with variable parameter counts are a piece of cake, they can return multiple variables, too! Tables are definitely one of the better data structures out there, the syntax is really nice, and you don’t have to worry about variable types.

Now, Lua is not without its quirks. you may have spotted some points just now that seem a bit strange compared to your average language. In Lua, you never explicitly state the type of a variable. This generally makes things a lot easier, but I can see how some people would like some more control over this. (Using tonumber() or tostring() is usually all you need though.) And then there’s tables. Lua doesn’t have arrays, lists, or any of that. Well, it does, but it’s all grouped under one single object type: tables. Personally I think they’re great. Mix and match different kinds of indices within the same table, use it to pass parameters, do all kinds of other sweet things. Lua indexing starts at 1 by default though. I personally don’t have that big a problem with it, but it definitely took a bit of time to get used to. (You can work around and have ’em start at 0 instead, but that’s not recommended, what with most libraries assuming you start at 1 and all.)

Despite its quirks, Lua is very lovable. Fun and easy to use, and released under the MIT license, allowing you to use it for any purpose whatsoever. Always nice, having such a liberal license in the software you use. It runs on a wide variety of platforms, so there really is very little reason to not give it a shot.

If you’re looking for a new language to learn, check it out!
~ Fang

Comments

  • 05/06/2013 (7:53 AM)

    :D Don’t know about Garry’s Mod, but for gamedev, Lua has been the scripting language of choice for me and most of my friends. Because it’s small, supports OOP and it’s fast.

    In Lua, there are several ways to do things, but usually one way to do it fast .. and the fastest way is usually not very intuitive (for me, at least).

  • 04/06/2013 (10:38 AM)

    I only recognize Lua from Garry’s Mod. Enter a game and suddenly you get a screen full of ERRORs.

  • 04/06/2013 (12:36 AM)

    Sometimes little quirks and simplicity can actually help things both more accessible and fun/easier to use. So it’s not as much of an issue when it comes to something as complicated as programming can be. It sounds pretty nice and yay you’re having fun doing things.

Post a comment

Your email will stay hidden, required field are marked with a *.

Experimental anti-spam. You only have to do this once. (Hint: it's "Fang")