Learn Lua the Hard Way
phailed.me
phailed.me
I am just a consumer of Zed Shaw's "Learn X the hard way" series...but this feels like a blatant mooching of his hard-earned credibility and intellectual property.
I would a) consult him and either distribute it through him with his permission, or b) rename it.
For all those people that hate on Zed, he seems like a pretty stand-up dude. Many people would be pissed about this.
However, the basic syntax and library of Lua is extremely simple. There is just not much to be said about it that you can not see from a few code samples.
What I would like to see is a comprehensive tutorial for the interesting stuff: How to use metatables, how to build great scripting APIs, how to implement object systems, how to use the C API efficiently.
But then, as I said, the official book does a good job of that already.
Lua was initially designed as an embedded scripting language.The most popular applications built using Lua are games! It's also used a lot in building plug-ins, most often embedded into other languages. This tutorial explains nothing significant about meaningful programming using Lua : how to write functions? how to build Tables(most important data structures in Lua) Arrays? Object-oriented programming in Lua?
Lua was a boon to game enthusiasts with no programming experience. Can an amateur even start developing the simplest of games using this tutorial? I think not.
I am a big fan of Zed Shaw's tutorials, and if one wants to follow a similar trend, they should be more consistent with updating their material for everyone.
From the first bits I read (up to the arithmetic bit), I think it falls into the pitfall of rambling about boring stuff and not getting straight into it.
Yeah, aspiring programmers need to know the difference between a comment and a string. Do they need to see a several page explanation of a comment and a string put in different places? Hell no.
Do they need to see how their script can do the same things a basic calculator does? If they're learning programming, then credit them with some intelligence.
How about a basic app that does something useful? We have so many APIs available to use now, and while it might be difficult to put them in a printed book (the API might not be around forever), I can think of few things more engaging than, say, replacing the 'Hello world' with a simple Twitter timeline fetching script.
Through that one example you can explain functions, types, variables, control structures, and documentation, and establish a solid base for delving deeper into the language and what you can do.
This will of course test the skill of the author more than it will test the patience of the eager learner. No bad thing.
But it'd be nice to have some Mac-friendly setup instructions. I'm sure I can figure it out for myself but others may find the information useful.
1) Download the source (http://www.lua.org/ftp/), and un-tar
2) Run "make macosx"
3) Optionally run "sudo make install" to place binaries in /usr/local
If you don't "make install", the interpreter can be run from the src directory.http://github.com/antirez/load81
Its an SDL-based environment for learning to program with Lua, and it includes an editor - as well as access to a number of useful primitives that can be used to draw graphics. I love Lua (been using it for years), but LOAD81 makes me really, really squeee with delight, because its just an easy environment to do things fast. If you go with the OS-based/homebrew-based Lua, you'll just get the interpreter - but with LOAD81 you get the interpreter plus graphics capabilities. Plus, the samples in the LOAD81 project are pretty good ways to get some bootstrap knowldege, too ..