<?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>Trevor Morgan &#187; lua</title>
	<atom:link href="http://trevor.lifespark.ca/archives/category/lua/feed" rel="self" type="application/rss+xml" />
	<link>http://trevor.lifespark.ca</link>
	<description>Thoughts on life, the universe and everything</description>
	<lastBuildDate>Mon, 20 Jul 2009 00:58:28 +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>Lua</title>
		<link>http://trevor.lifespark.ca/archives/40</link>
		<comments>http://trevor.lifespark.ca/archives/40#comments</comments>
		<pubDate>Sun, 06 Jul 2008 16:03:09 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[lua]]></category>

		<guid isPermaLink="false">http://trevor.lifespark.ca/?p=40</guid>
		<description><![CDATA[Spent some time exploring Lua.  This language has caught my interest, not least because Lightroom is largely implemented in it.  I&#8217;ve played around with it briefly before on Linux, and I have to admit that the experience of getting it up and running is much less painful on Ubuntu than on Windows.  $ apt-get install [...]]]></description>
			<content:encoded><![CDATA[<p>Spent some time exploring <a href="http://www.lua.org/">Lua</a>.  This language has caught my interest, not least because <a href="http://www.adobe.com/products/photoshoplightroom/">Lightroom</a> is largely implemented in it.  I&#8217;ve played around with it briefly before on Linux, and I have to admit that the experience of getting it up and running is much less painful on Ubuntu than on Windows.  $ <em>apt-get install lua</em> is much faster than downloading tarballs, creating visual studio solutions from scratch, mucking around with paths and dependencies and resolving any number of LNK2005 errors.  But I got there in the end.  Specifically, I</p>
<ul>
<li>Downloaded the Lua source from Lua.org.</li>
<li>Created a Visual Studio DLL project containing all the source files apart from lua.c and luac.c</li>
<li>Built this DLL to create lua.dll</li>
<li>Created another project with just lua.c, and linked to the above DLL</li>
<li>Built this project to create lua.exe. Now I&#8217;ve got a lua environment.</li>
<li>Downloaded the luabind source from <a href="http://www.rasterbar.com/products/luabind.html">Rasterbar Software</a>. This seems to be based on the powerful <a href="http://www.boost.org/doc/libs/release/libs/python/doc/">Boost.Python</a> library, which I&#8217;ve had a lot of success with in the past.</li>
<li>Created another Visual Studio project for luabind, add the luabind source files and link with lua.dll.  Luabind does come with a <a href="http://www.boost.org/doc/tools/build/doc/html/jam/usage.html">bjam</a> make file, but I usually find bjam a complete headache to use.</li>
<li>Created yet another project with the sample code from the luabind tutorial, built and linked against the luabind library and lua.dll</li>
</ul>
<p>After all this, (and several hours of tweaking linker settings) I&#8217;ve now got the tutorials working to the extent that I can now do two things.  I can expose C++ functions into a Lua program, which is very handy, and something I&#8217;ve found very useful in Python.  But of course, the big draw to Lua is that it can be embedded in an existing C or C++ program!  So now I&#8217;ve also got to the point where I can contain a Lua interpreter within a C++ application, pass a string of Lua code to that interpreter to be executed, and even let provide the interpeter with the ability to call out to C++ functions elsewhere in the program.</p>
<p>So despite the the hoops I had to jump through, I think this could be a very powerful environment.  Now I just need to learn the Lua language itself, but as they say, if you can&#8217;t learn a new language in a weekend you shouldn&#8217;t call yourself a programmer.</p>
]]></content:encoded>
			<wfw:commentRss>http://trevor.lifespark.ca/archives/40/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
