If you want to build yourself the latest Lua on OS X there is a simple recipe for this:
- Start by downloading the Lua source code from http://www.lua.org/ftp/.
- Extract the archive (I did this in my Downloads folder).
- Open a Terminal and navigate to the Lua source code:
cd Downloads cd lua*
- Decide where you want to install Lua on your system, the default is /usr/local. My recommendation is to install Lua in /usr/lua-5.2.
- Build and install Lua:
sudo make macosx install INSTALL_TOP=/usr/lua-5.2
In order to be able to use the Lua we’ll need to add the interpreter to our system path, paste the next line in a Terminal:
and start the interpreter by writing in the Terminal:
Try some Lua expressions in the interpreter:
1 2 3 4
print("Hello World") a = 10 b = 25 print("a + b = ", a + b)
You can permanently add Lua to your system path by saving the above export line at the end of your .bash_profile file.
If you are interested in learning Lua, I would recommend reading Programming in Lua by Roberto Ierusalimschy:blog comments powered by Disqus