“Programming in Lua”

Over the week-end, the copy of Programming in Lua that I’d ordered arrived at the bookshop. So I’ve been able to make at least a small start on the book, and get some of the ideas into my head. Having looked at the first 40 or so pages, I can see why Lua has been chosen for integration with TeX as LuaTeX. Some TeX concepts are also Lua concepts (such as the scope of variables and the ability to re-define anything), and so the fit between the two languages looks good. How that translates in practice I’ll have to see.

What I have found to date is that you really don’t want to be a beginner if you pick up Programming in Lua. The book starts with a lot of pretty complicated programming ideas, and without some background I’d be in trouble. Luckily I’ve picked up bits and pieces over the years (from Basic, C and Perl, amongst other things), and so I’m not totally lost. But for a book aimed at people starting off with the language, it is tough going.

The arrival of the book happily coincides with the release of LuaTeX 0.36.0, as announced on the LuaTeX mailing list. There are a number of changes aimed at making more changes in the future, but at least I can now begin to understand what some of them mean!

2 thoughts on ““Programming in Lua”

  1. FWIW, I studied programming languages in school, designed my own (like so many others) that was never implemented (like so many others). I was/am completely impressed by Lua; it’s the cleanest design I’ve ever seen. But I think the big win for TeX is that it was designed to be embedded; embedding Perl, Python, Ruby, whatever, would lead to endless trouble. With Lua, it is at least relatively straightforward.

    I wonder if there are any intro-to-lua books or web tutorials or whatever. You’re surely right that PIL is not for beginners. We had Roberto come to TUG’07 and give a tutorial, but that doesn’t much help now!

  2. I’m not really in a position to judge the relative merits of different embedded scripting languages (as far as I can tell, there are supporters for every approach). However, Lua looks at least a good choice for TeX.

    I’m sure that there is something around on the web for learning Lua. I just wanted to start with something printed, and there only seem to be a couple of choices (PIL or “Beginning Lua Programming”). PIL seemed like a good place to start as it’s “official”. I guess that over time something more TeX orientated will appear (perhaps on CTAN, if we’re lucky). “LuaTeX Programming for Beginners”, anyone?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.