Codea: Lua Programming on Your iPad

The iPad is a great tool for almost anything nowadays but one of the categories that app developers seemingly haven’t delved into is programming. Sure, there are plenty of HTML and Markdown editors out there on the App Store (Byword is a great example of one of these) but for creating iPad apps, you’ll either have to make do with what’s on the App Store or sit down and learn Xcode, which has a steep learning curve and requires plenty of additional knowledge, such as Objective-C.

But now, some smart Australian developer by the name of Simeon Nasilowski has come up with the brilliant idea of being able to program (simple) iPad apps – and all straight from your iPad. Codea (formerly known as Codify) is not only a simple way of designing your own iPad apps but also features plenty of built-in tools and tricks to help make your programming experience a lot more easier and, dare I say it, enjoyable.

Read on after the break for my thoughts.


Like the article? Be sure to subscribe to our RSS feed and follow us on Twitter to stay up on recent content.

First Thoughts

Codea is an all-in-one programming solution for games, simulations and more and is available off the App Store for $9.99. It uses the Lua programming language which is powerful, lightweight and quick at performance and has been used in commercial programs such as Adobe Photoshop Lightroom, World of Warcraft and VLC and is currently one of the leading scripting languages for gaming software. Although it is not as difficult to learn as some languages, you’ll still require a fairly basic knowledge of programming to be able to get to grips with it.

Codea-Screen-Projects-1024x768.png

Projects in Codea.

On first run, you’ll be greeted by Codea’s welcome screen which gives you a quick overview of any projects you are working on along with plenty of examples of projects created by the Codea team. There is also easy access to the concise Codea community and Lua reference manual, which can be accessed directly from the app.

Your First Project

To create your first project, go ahead and hit Add New Project and give it a name. The editor view of Codea then pops up with your new project with a few commands already pre-defined.

Editor View

The Editor view.

When you bring up the code editor, you will notice that the default iPad keyboard has been slightly touted up with some hot keys. This enhanced keyboard makes it far easier to code in Codea and features shortcuts to some of the most common tools in Codea, such as tabs, quotations, operators (plus, minus and so on) and a shortcut to the preview mode, allowing you to view your finished creation. Whilst typing, Codea will also automatically bring up a list of commands based on the first letter you type, giving you a better overview and allowing you to type commands a lot quicker.

Codea Enhanced Keyboard

The enhanced iPad keyboard on Codea.

Codea comes with one theme by default – the light one seen above – but if you want to feel like a proper programmer, you can purchase a dark theme (more information available here) via a one-time app purchase of $1.99.

Quick Reference

One of Codea’s most useful features is built-in Lua documentation, which is accessible directly from the keyboard by tapping the little eye symbol.

Codea Lua Documentation

The built-in quick reference guide to Lua in Codea.

The documentation includes an explanation on exactly how Codea works with a sample code example and an explanation of most Lua functions with examples for commands, variables and constants. It’s a real life-saver if you just want to look something quickly up without having to switch to the online documentation, which is very extensive.

Styles

To help give your Codea projects some extra flare, the developers have integrated plenty of styling tools to make this far easier.

Fonts

Although the default font in Codea is Helvetica, you can also choose from a wide range of Apple fonts (including one of my favourites – Myriad Pro) along with a preview to see exactly what the font will look like in your project.

Codea-Photo-FontPicker

Codea's font picker with a preview.

Picking Colours

Codea also includes a useful colour selector wheel which pops up when you type the relevant command. You can pick your desired colour either using the wheel or via the RGB HTML specification.

Codea-Photo-ColorPicker

Picking your desired colour using the selector wheel in Codea.

Photos

Integrating photos into your Codea project is really easy. Photos can either be pasted straight into the app by copying onto your Pasteboard or you can import photos that are already on your iPad (either from your Camera Roll or from your iCloud Photo Stream). You can also set up Codea to integrate with Dropbox as well, meaning you can import photos from your Dropbox account as well.

Codea-Screen-Code-ImagePicker-1024x768

Picking an image from one of the built-in Sprite Packs.

Codea also includes several built-in item packs as well along a variety of themes (known as “Sprite Packs”). There are a couple of packs that are free however some will cost you $1.99 (via an in-app purchase).

Preview Mode

When you’ve finished coding all your project, it’s now time to see what the finished result will look like! The preview mode in Codea allows you to see exactly what your project will look like straight from the app and will flag up any coding or syntax errors before you start running it so you can correct them without too much difficulty.

Codea-Photo-UserProject-Jump

Viewing a project using Codea's built-in Preview mode.

In the Preview mode you can take screenshots directly by just tapping directly on the Camera icon and any shots taken can be saved either to your iPad’s Camera Roll or tweeted directly from the app. You can also make short screencasts of your Codea project, which can also be saved to your iPad for further processing.

Conclusion

Codea was awarded the Most Innovative App award of 2011, and it’s absolutely clear to see why. Although there are other code editors out there on the app, none of them will allow you to be as free and creative as Codea. The best way to start experiencing it is to download it and join their helpful forums, which contain loads of tips on how to improve your projects. There is a slight learning curve in using Codea, though, especially if you haven’t got any previous programming experience but given the range of results that can be achieved (look at Cargo-Bot, for example, which was programmed entirely in Codea) it is certainly a learning curve that is worth it.


Summary

A utility to help you program games, simulations and more in the Lua programming language on your iPad.

9
theatre-aglow
theatre-aglow
theatre-aglow
theatre-aglow