How does Codea work

Hey guys.
I’ve been studying how programming languages were created and how they work. Interesting stuff really. But when I look at how all the commonly used languages today work, it seems that they don’t really do what Codea does. (Namely the graphics and visual displays that Codea has.) I was curious on how Codea is able to do all these things.

@Progrmr235 - Codea is built on Lua (the basic language), plus OpenGL for graphics and Box2D for physics. It is ingeniously sewn together so it looks like one coherent package, but full credit to the developers for making it so easy to make graphic apps.

Oh, so Codea uses multiple languages to achieve it graphic capabilities?

Codea “wraps” the commands from other packages so it looks as though Codea is doing it all

Oh, ok. So Codea basically just executes the commands given, but there are other things that do most of the work

Codea is a lua interpreter and editor. The only “language” bit of it is lua.

Seperate from that is an API that TLL has put together to allow you to call various libraries straight from lua without having to jump through extra hooks. Beneath the surface these APIs are calling out to things such as Box2d for physics, and the APIs that Apple has provided through objective-C for things such as OpenGL, strokes, gravity sensor, camera etc. These are not languages, they are APIs to things other people have built.

In building the API for Codea, TLL has made choices to simplify the API compared to what you might use in xCode with objective-C, this has a massive benefit of making coding easier, and a cost in that sometimes you can’t control it fully. For example, when using setContext(image) you get an image you are drawing to other than the screen, but this is always a depth compliant OpenGL thingy. If you don’t need depth, you can’t switch it off so it performs a little slower. The benefit is, it’s really easy, if you were doing this yourself in C you would write a LOT more code than setContext(image).

IMHO TLL has done a brilliant job of exposing all of the power of these libraries while keeping to a simplistic lua oreinted way of doing things.