Did you hear about the new on-device editor and simulator that uses Lua for development? It is called Codify, from TwoLivesLeft, another Australian Development company. Simoen has, really has shaken the world with this beautiful code editor. Not only is it a code editor, it is also a simulator, one can run the code to see the results. I had a chance to review it earlier before it was released and it was here .

I have been dabbling with Lua and a lot of the readers have been playing with Lua. The biggest issue today is that there is no common framework, the common language is Lua, but the various frameworks that offer development capabilities are as fragmented as versions of Android. Be it CoronaSDK, Moai, Kobold, Gideros, they all work with OpenGL for rendering but each has their own little display engines. Codify is no different, it is based on OpenGL but has it's own display engine that is modeled on the Processing library. This therefore gives codify an advantage of particles, vectors which some of the other languages do not have and require 3rd party or custom libraries to include these functionalities.

The mobile form factor of Codify makes it difficult to add stuff, be in music, graphics, but the way that it has been handled by the developer is amazing. I can go on raving about how cool it is, the web is already abuzz with information and raves about it. However if you have an iPad, I can only suggest that you look at spending $7.99 and get Codify on your device.

There are demonstration videos that are on you tube demonstrating the cool features of codify, and then there are other developers that have played and made some cool contributions which are shared via pastebin, email or other such ways.

Let us look at the development side of things on Codify. What does it take to write an simple program using Codify?

Codify has two hooks, these are similar to viewDidLoad and the drawRect methods if you were developing using Obj-C. These two hooks are functions that are called when the app starts and is called setup() and the one that does the painting of the screen every frame aptly called draw()

 function setup()
  --we can initialise our variables here
  appName = "Test app"
  number = 3
 --bear in mind this is called every frame and there are
 --30 frames per second
 function draw()
  print("We have " .. number)
  number = number + 1

so if we run this, we shall see that there are a series of outputs. The difference between Codify and some of the other frameworks is that in Codify, the developer has to update the screen every frame (1/30th of a second)

Drawing graphics are not difficult either, there are no objects to derive from, so drawing a line is as simple as

We can change the colour of the background and the objects we draw.



you will see a line float from the bottom of the screen upwards, this also tells us that Codify has the origin point 0,0 at the left bottom of the screen, no the top left as many other frameworks have. There is a very comprehensive reference manual with Codify in the app itself, which provides information about the function available with Codify.

The coolest thing that is missing from another favourite lua based framework is the vector math library. so there are a lot of users that have questions on how to determine the distance or the angle or rotation, etc because they jump into development but leave out the math and physics part, well it has never been interesting in school, but in terms of development that is the basic lifeline.

so imagine things like

  vec1 = vec2(50,50)

  down = vec2(0,-1)
 orientation = down:angleBetween(vec1)

so we have gotten the angle between the vectors 50,50 and 0,-1, now we can simple rotate the object using


This was just an introduction, if possible we shall have some really cool projects that one can type in and have fun or teach kids.


  1. Excellent ! Great tutorial, thanks so much. Is there a way to subscribe to your blog ?

  2. How easy is it to make a program for Corona, copy all the code to Codify and then change some code parts to make it run?

  3. @Oskwish,
    Please collect your membership badge when you leave... Join the Club.

    A lot of developers want to consider the possibilities of using Codify as an editor for CoronaSDK. I have corresponded with the Developer and he likes CoronaSDK and *might* consider that at some stage.

    However, codify works on the Processing libraries, the origin is different than that of Corona, there are plenty of subtle differences.

    Short answer, it will require a fair bit of work to convert (in my opinion).


Post a Comment

Popular Posts