Archive for October 7th, 2009


iPhone Wax

And today, we’re going to tell you how to make your iPhone extra-shiny!

No, actually, “iPhone Wax” is an oddly-named project that lets you write native apps in Lua, of all things.

I started investigating how I might wire up — and then write native iPhone apps from — a scripting language. Lua was on my radar already. It’s compact, expressive, fast enough, and was designed to be embedded. Took only about 20 minutes to get the Lua interpreter running on the iPhone. The real work was to bridge Lua and all the Objective-C/CocoaTouch classes. The bridge had to work in two directions: it would need to be able to create CocoaTouch objects and also be able to respond to callbacks as part of the familiar delegate/protocol model.

I tweeted about my intentions. Corey Johnson responded that he’d been working along the same lines and, dang-it, his implementation was exactly what I had in mind. It’s called iPhone Wax, it’s brilliant, and Apple has already approved one app using it.

Intriguing? If so, read the above article, check out the code on github, a sample on github, and the Google group.

Now, there is some fuzziness about what exactly the status is of interpreted scripts for App Store acceptability purposes. Downloading scripts to extend application functionality is pretty clearly out of bounds, but it’s not completely clear whether scripts bundled in your application are officially acceptable or not — and if not, whether using Lua’s bytecode interpreter for semi-compiled scripts avoids that line. But hey, one slipped through at least … if it’s still on the store by the time you’re reading this, apparently you can get away with it!