<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>lua nova &#187; installation</title>
	<atom:link href="http://luanova.org/tag/installation/feed/" rel="self" type="application/rss+xml" />
	<link>http://luanova.org</link>
	<description>welcome to the moon</description>
	<lastBuildDate>Thu, 20 May 2010 16:18:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Launch: getting Lua installed</title>
		<link>http://luanova.org/launch-getting-lua-installed/</link>
		<comments>http://luanova.org/launch-getting-lua-installed/#comments</comments>
		<pubDate>Sun, 11 Nov 2007 06:47:35 +0000</pubDate>
		<dc:creator>nathany</dc:creator>
				<category><![CDATA[Lua]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://luanova.org/2007/11/10/launch-getting-lua-installed/</guid>
		<description><![CDATA[To play with Lua you need to download the source code and compile it. This isn&#8217;t as scary as it sounds, as Lua is a positively tiny download and doesn&#8217;t depend on anything more than a C compiler. Lua is written in standard ANSI C, so any one should work. I will give instructions for [...]]]></description>
			<content:encoded><![CDATA[<p>To play with Lua you need to download the source code and compile it. This isn&#8217;t as scary as it sounds, as Lua is a positively <em>tiny</em> download and doesn&#8217;t depend on anything more than a C compiler. Lua is written in standard ANSI C, so any one should work. I will give instructions for <strong>Mac OS X</strong>, because that&#8217;s what I use.</p>

<h2>Building</h2>

<p>First, you need to have Apple&#8217;s Developer Tools installed. They should be your Mac OS X disc, under Optional Installs -&gt; Xcode Tools. Run the XcodeTools package to install. You can also <a href="http://developer.apple.com/tools/download/">download Xcode</a> if you sign up for a free ADC account (but note: they are large!).</p>

<p>Next, <a href="http://www.lua.org/download.html">download Lua source code</a> and unpack the archive in Finder. Or you can use <strong>Terminal</strong> to download the current  release (5.1.2) to your Downloads folder (or a suitable location of your choice):</p>

<p><code>cd Downloads
curl -O http://www.lua.org/ftp/lua-5.1.2.tar.gz
tar xzvf lua-5.1.2.tar.gz
cd lua-5.1.2</code></p>

<p>Either way, you need <strong>Terminal</strong> (from Application/Utilities) to do the rest. Make sure you are in the lua-5.1.2/ folder, and type:
<code>make macosx</code></p>

<p>Several lines should scroll by. On Leopard you will see some <em>deprecated</em> warnings in loadlib.c. Don&#8217;t worry about it. To make sure everything is okay, run:
<code>make test</code>
You should see <strong>&#8220;Hello world, from Lua 5.1!&#8221;</strong></p>

<h2>Installing</h2>

<p>It is possible to run the Lua interpreter from right here, but let&#8217;s install it the rest of the way. For this we will need to run &#8220;make install&#8221;. By default Lua installs to /usr. This will work, but it&#8217;s recommended to install under /usr/local.</p>

<p>So from the lua-5.1.2/ folder, run:
<code>sudo make install INSTALL_TOP=/usr/local</code>
and provide your password.</p>

<p>It appears that Leopard ships with /usr/local/bin in your path. You can check by running: (make sure PATH is uppercase)
<code>env | grep PATH</code></p>

<p>If you don&#8217;t see it there, you need to modify your .profile file.
<code>pico ~/.profile</code></p>

<p>and include:</p>

<p><code>export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
export MANPATH="/usr/local/man:$MANPATH"</code></p>

<p>If you are using <a href="http://macromates.com">TextMate</a>, and will be installing the Lua bundle later, you may also want to include:</p>

<p><code>export SVN_EDITOR="mate -w"
export LC_CTYPE=en_US.UTF-8</code></p>

<p>With pico, press Ctrl-X followed by Y to exit and save.</p>

<p>The changes will take affect when you open a new Terminal window.</p>

<h2>Running</h2>

<p>With Lua installed in your path, you can run it in Terminal from any folder. Just type:
<code>lua</code></p>

<p>This brings up the interactive interpreter. You can type in Lua code:
<code>print "Hi"</code>
<code>= 2 + 3</code></p>

<p>Press <strong>Ctrl-C</strong> to exit when you&#8217;re done.</p>

<p>Now that Lua is installed, you <em>could</em> remove the Downloads/lua-5.1.2 folder. But you may want to check out the test/ folder for some example code. You can run these examples from within the lua-5.1.2/test/ folder like this:</p>

<p><code>lua factorial.lua</code></p>

<p>A local copy of the <a href="http://www.lua.org/manual/5.1/">Reference Manual</a> can be found under doc/manual.html.</p>

<h2>TextMate</h2>

<p>If you are using <a href="http://macromates.com/">TextMate</a>, there is a Lua bundle to give it color syntax highlighting and a few snippets. Unfortunately the Lua bundle isn&#8217;t included by default. You can either use <a href="http://projects.validcode.net/getbundle">GetBundle</a>, or you can grab it with the command line as follows.</p>

<p>The bundles are stored in a Subversion repository, which requires Subversion (svn) on your computer. Leopard comes with Subversion, but for Tiger or prior you need to install it. I&#8217;ve had good success with <a href="http://homepage.mac.com/martinott/">Martin Ott&#8217;s Subversion package</a>.</p>

<p>As per the <a href="http://macromates.com/textmate/manual/bundles#getting_more_bundles">TextMate manual</a>:</p>

<p><code>mkdir -p /Library/Application\ Support/TextMate/Bundles</code>
<code>cd /Library/Application\ Support/TextMate/Bundles</code>
<code>svn co http://svn.textmate.org/trunk/Bundles/Lua.tmbundle</code></p>

<p>You need to restart TextMate or navigate to to Bundles -&gt; Bundle Editor -&gt; <strong>Reload Bundles</strong> in the menu.</p>

<p>Files with a .lua extension will be associated with the Lua language bundle. One nice feature is that you can press Command-R to run them.</p>

<p>So that&#8217;s about it for getting setup. Now we just need to write some code!</p>
]]></content:encoded>
			<wfw:commentRss>http://luanova.org/launch-getting-lua-installed/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
