Advertisements

Geek Proud, GeekOut.

Lua: A Simple Programming Language?

In the past, we’ve looked at languages such as php, JavaScript, Java and more. I’ve used a number of languages for a multitude of purposes. Recently, I mentioned how I was working on an AddOn for Elder Scrolls Online. It’s almost done now, but before I go into more detail about that, I thought I’d share with you the basics of the Lua language. If you’ve ever wanted an easy way to get into coding, here’s a quick introduction to Lua and how you can use Lua to get into programming whilst still having a lot of fun. Sounds good? Read on!

Lua, A Simple Programming Language

Lua is a fast and lightweight programming language. It’s easily embeddable in existing programs, which helps make it a favourite for plugins/mods for games. Naturally, you can do a lot with the language. You can make your own fully-fledged games, or you can make standalone software. It’s already being used in some of your favourite games and mods, which is why it’s such a well loved choice. Due to how well received it was in video games, it started to get used in many applications, including in automotive, database management, education and much more. Basically, if you think you want to do it, Lua probably can do it.

Notice I say probably? That’s because Lua, whilst fast and lightweight, it isn’t the most extensive of languages. That’s why it’s such a great choice for people who want to make mods for games. It’s also the perfect language for people to use if they want to manipulate an API you create. Basically, Lua is a powerful little language, but it doesn’t have anywhere near as much power as anything like C, or maybe even Java. If that doesn’t bother you, then Lua is a perfect language to start out with.

Lua has a lot of resources online, as well as an official website where you can buy their guides. There’s also a free first edition that you can read up, which covers most of what you’d need to know. Basically, if you want to get into Lua, there are plenty of excellent resources. This is particularly useful, but what if you want to learn how to code in Lua without having to make your own fully-fledged programs, there is a way!

ComputerCraft for Minecraft

One of my favourite plugins for Minecraft is ComputerCraft. Along with the usual Minecraft experience, in ComputerCraft, you are given access to some unique new blocks. The normal computer and the advanced computer, along with peripherals. The peripherals include printers, screens, turtles, wifi devices and more. The plugin gives you all of the tools you need, but doesn’t give you any real instructions on how to use it all. Thankfully, the ComputerCraft website is wonderfully documented.

ComputerCraft gives you the tools to get started with coding in Lua. It’s really simply put together, but basically you have to make your own files which ComputerCraft will read. You can make it so these applications trigger on startup, or not. On one of my old servers, I had programmed a whole group of turtles, which are effectively robots. I coded them to be able to chop down a whole forest, then replant the forest. This was a huge undertaking, as these robots were all programmed by a central data centre, which detected when the trees were ready to be chopped down and then remotely told the turtles to get going.

If there’s something you can think of in Minecraft using these computers, you can do it. I created an in-game “intranet” on one build, which allowed people to connect and “report” their findings to each other, so there was always a log of what happened when people logged into the game. Ultimately, if you want to get coding and want an easy way into it, I’d highly recommend getting ComputerCraft. However, if you’ve ever programmed in Lua before, or if you’re just interested, share your thoughts of the language in the comments below, or over on Facebook and Twitter. Perhaps one day we’ll do a primer on the language?

Advertisements

Drop us a line

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.