Friday, October 29, 2010

setting up Lua on Mac

Recently, fell insterested in Lua due to some work with lighttpd. So, want to share some experience setting up an IDE-ish environment (of course, VIM is always the best editor).

1. install lua and luarocks through MacPorts:

2. failed attempt setting up LuaEclipse following instructions at

Update: Finally I got LuaEclipse set up correctly, please see my latest post for instructions.

LuaEclipse is a great IDE, however developers did not seem to be updating the project often and it does not work due to some 64bit jni library issues on Snow Leopard.

I first tried to install through update manager from Aptana Studio 2.0, got this error:

/Applications/Aptana Studio 2.0/configuration/org.eclipse.osgi/bundles/224/1/.cp/libluajava-1.1.jnilib: no suitable image found. Did find: /Applications/Aptana Studio 2.0/configuration/org.eclipse.osgi/bundles/224/1/.cp/libluajava-1.1.jnilib: mach-o, but wrong architecture

Could not initialize class org.keplerproject.luajava.LuaState

Then I tried to install a 64bit Eclipse and install the LuaEclipse through update site and manually install the plugin zip, both failed

a) through the update site, it does not work, always complaining one dependent package is missing from update site

b) download the plugin and install manually, installed fine, but cannot run, got error a specific directory is missing

Conclusion: forget about LuaEclipse

3. Install a TextMate bundle:

TextMate is the choice of text editor for Mac. This Lua bundle worked perfectly for me. The only thing is that TextMate might be installed differently, so you may need to tweak the script to the "Library/Application Support/TextMate/Bundles" in your home directory, at least I had to do that. Also note that you need to configure the PATH variable in TextMate so that the lua executable can be found by TextMate.

If you are interested in Lua, Programming in Lua (2nd) is the best book to cover the basics from the original Lua developer.

No comments:

Post a Comment