LuaCocoa v0.3.3 Released and v0.4.0 Imminent


I have been working hard on major new features for LuaCocoa. These features are so big, that I decided to rollout a final 0.3 release so I can get a clean slate with 0.4.

So as of today, LuaCocoa 0.3.3 is out. (Binary package is already posted.)

Version 0.4.0 has been in heavy development on my Assembla branch for over a month now. With 0.3.3 done, I immediately merged my 0.4 branch into mainline and you can grab it from the main repository at BitBucket.

Objective-C Blocks

The big new feature in LuaCocoa is full support for Obj-C blocks which allow you to do everything you might expect, e.g. create blocks from Lua functions,  auto-coerce Lua functions when passed as a parameter to a function expecting a block, invoke blocks from Lua, pass blocks through both sides of the bridge, etc. This even works fully with structs.

Like everything else in LuaCocoa, the details have been worked out to make memory management automatic on the Lua side and works with both classic Obj-C memory management and Obj-C garbage collection. Also, special safeguards have been implemented to make sure block callbacks that callback on a different thread are re-routed back to the originating (Lua) thread.

Objective-C Categories

Also new to LuaCocoa is support for defining categories in Lua. The interface works like subclassing. 

Struct Improvements

And there have been improvements for structs including much faster performance.

Prototype Launcher and New Examples

I've found the HybridCoreAnimation app so handy for experimenting and testing LuaCocoa code that I created a new general purpose app called Prototype Launcher that works almost just like it so you can use it to test your own code. It sports additional conveniences like being able to open Lua files through the File menu and maintains the Recents list.

Compatibility Notes

Due to the requirements for blocks, 0.4 will may impact backwards compatibility, particularly on 10.5. For the moment, as long as you don't use blocks on 10.5, LuaCocoa should work. But after the 0.4.0 release, 10.5 will likely be dropped.

Also be aware that automatic coercion of Lua functions into blocks requires proper BridgeSupport metadata to be available. Unfortunately, this data only exists on 10.7+. To use on 10.6, you must manually create blocks (see LuaCocoa.toblock()) or possibly generate your own updated BridgeSupport XML data and bundle with your app.

0.4.0 Releaslng Soon

So far, this branch seems to be working pretty well. A few people stumbled upon my Assembla branch and have generally reported positive results as well. Please try out the tip and let me know how it works. I plan on releasing this very soon so I can start on the next big thing.

Release Notes for v 0.3.3: (CoreGraphics fix for CFTypes moving through the bridge, new sample project showing subclassing/delegate pattern in Lua with NSOpenPanel and NSSavePanel)

- Dealt with bug where CFTypes from CoreGraphics crossing through the bridge were being corrupted.

- Added new example demonstrating the classic delegate pattern featuring NSOpenPanel and NSSavePanel. This example will be complimented by a new example showing the blocks (closure) pattern in the next release utilizing the new Obj-C blocks APIs for NSOpenPanel and NSSavePanel.

- Other minor fixes

To learn more about LuaCocoa and grab the binaries, please visit:

Copyright © PlayControl Software, LLC / Eric Wing