This is awesome. I will take [a single huge list of self-explanatory example snippets (with a few short comments here and there) for 95% of use cases] over [detailed walls-of-text docs pages spread across a hierarchy of topics] any day.
I agree, but can't help but wonder if the "me" from 20 years ago would have found this very confusing while I was learning to program. I learned from books with all that long-winded banter - so now I'm not sure if I actually NEEDED all that stuff in order to learn. Guess I'll never know.
This method, however, is PERFECT for anyone who already knows how to program. I love it, and actually came here to say that I wish everything everywhere had a page like this on the web.
The brass tax, get down to business, of ANY topic in 15 minutes.
I'm glad this comment sits at the top of this thread. I do hope that more and more learning resources come to us in this form, which is a very good thing to give you an idea of wether you would like to jump into a language (or maybe even a framework/platform?). OP did a very good job.
That said, Lua is quite the special case, as it does not require much time to get up and running with it. This is one of the reasons why it is the scripting language of Redis by the way (Antirez even wrote Total time require to master it enough? 5 minutes.[1] regarding building scripts for Redis).
Along the same lines is http://hyperpolyglot.org/ (which has been posted here a few times). This is useful both for learning a new language and for a quick reference for languages you're not so hot on. It's also very interesting to compare similarities and how languages have influenced each other.
It seems (from the comments here and my own experience) that many people really like this style of learning. It would be great to see it applied in more areas.
I was so happy with Lua and thought it was such an elegant and clean language.. then I looked at the side-by-side comparison between Lua and Io on the site you linked.. and now it seems clumsy and ugly.
Unfortunately a language is only as good as its implementation and tooling and Io's implementation is "experimental" at best (and development is pretty much dead) + the utter lack of tools and third-party support so I will have to stick with Lua.. and try very hard to forget Io again.
This is a good start, but there's also some deeper ideas in Lua. It has a good implementation of coroutines, for example; if you're familiar with continuations from Scheme, they fit most of the same uses. (They're like generators from Python or fibers from Ruby, but with less edge cases.)
The C interop is also a Big Deal. Lua seems like a cute little language, like a cleaner Javascript, but it's a LOT more useful if you're also proficient in C. Also, Lua will run anywhere you have an ANSI C compiler and a modest amount of space.
Coroutines are tricky, and you need to explain them, not just present a bit of code. I think it is the right decision to omit them from a 15-minute intro. The C API is way out of scope.
I would cover assert() statements and the common (exit_status, result) var return, since that is so idiomatic. Maybe also loading chunks.
On that note, I don't understand all the javascript craze. Lua has been around for quite some time, and it's small, with well-defined semantics, a nice set of features, the interpreter is small and very fast, you can get even faster with LuaJIT, etc. Browsers should have adopted that ages ago.
Actually, the Lua Missions are excellent! I highly recommend taking the time to work through them. More than just a series of exercises (like most of the foo-koans), there's actually a narrative and a larger lesson you can learn if you work through the full problem set.
Lua can be great. I've worked with it extensively on a personal project, where I've embedded it in a C++ app. However, there are some things that you will hate:
* Trying to correctly do "inheritance"
* Having to write all of your batteries for common ops
* Array indices begin at 1!
* Poor debugging support
Aside from those thing, Lua is great. It's crazy fast and easy to embed.
I prefer learning this way also, so I wrote something sort of similar for Vimscript a while back. The # of people that ever need to use vimscript is low, but it's out there for people to get their feet wet.
Almost the same experience but with Love2D[1] instead of Corona.
After learning Lua I also suggest to take a look at MoonScript[2] a dynamic scripting language that compiles into Lua, you can think about it as the CoffeeScript of Lua.
Since I became a Lua programmer, I really can't stand any other languages, and I've rapidly switched to it for my scripting needs. Tables are just soooo lovely. ;)
Well, it helps a lot that Lua is by design a very small language :)
Python is actually much bigger nowadays -- I would challenge someone to come up with something this simple that doesn't leave out a lot of stuff you will encounter in real code.
The extra features ("bloat") do matter. I like the idea of Lua a lot, but when I started programming in it, it unfortunately felt like a less capable Python to me.
That took me 30 minutes to read. I think I might feel like I've learned the language after spending 8 hours working the examples a la "Learn Python the Hard Way". Luckily, I'm not competing with the folks here that learned it within 15 minutes ;-).
The title is a bit optimistic :) That's how long it takes me to read as if I were reading a novel, which isn't quite fair.
I wanted to express something like "hey, this guide is for programmers and is surprisingly short and easy to consume considering it covers the large majority of the language." The current title seemed a bit snazzier.
This is a neat little reference but I can't waste the opportunity.
I've seen people say they've never seen complaints about fonts being too big? Well here I am, complaining that the fonts are so big this page is hard for me to read without zooming out.
That was a pretty cool crash course on Lua Tyler! Thanks for putting that together and sharing it. After having had worked with numerous languages over the years such as Fortran, Pascal, Ada, C, Java, C++, C#, Python and Objective-C, I must say that working with Lua is my favorite. I'm thankful to a buddy of mine for introducing it to me. My own personal experience has shown me that working with Lua really allows you to focus on solving the problem versus getting wrapped around the axle at the programming language level. Thanks again
I learned to love lua when writing basic sysadmin scripts for OpenWRT based systems. I had previously used perl for sysadmin stuff, but perl (even microperl) took too much space on OpenWRT boxes with 4MB flash drives. Lua to the rescue. Now I chafe when I have to go pack to perl.
I do wish someone had handed me this on the first day I realized I needed lua.
[+] [-] karpathy|12 years ago|reply
[+] [-] dpcan|12 years ago|reply
This method, however, is PERFECT for anyone who already knows how to program. I love it, and actually came here to say that I wish everything everywhere had a page like this on the web.
The brass tax, get down to business, of ANY topic in 15 minutes.
[+] [-] uniclaude|12 years ago|reply
That said, Lua is quite the special case, as it does not require much time to get up and running with it. This is one of the reasons why it is the scripting language of Redis by the way (Antirez even wrote Total time require to master it enough? 5 minutes.[1] regarding building scripts for Redis).
[1]:http://oldblog.antirez.com/post/scripting-branch-released.ht...
[+] [-] tylerneylon|12 years ago|reply
[+] [-] fuzzix|12 years ago|reply
[+] [-] unknown|12 years ago|reply
[deleted]
[+] [-] kemist|12 years ago|reply
[+] [-] dave1010uk|12 years ago|reply
It seems (from the comments here and my own experience) that many people really like this style of learning. It would be great to see it applied in more areas.
[+] [-] copx|12 years ago|reply
I was so happy with Lua and thought it was such an elegant and clean language.. then I looked at the side-by-side comparison between Lua and Io on the site you linked.. and now it seems clumsy and ugly.
Unfortunately a language is only as good as its implementation and tooling and Io's implementation is "experimental" at best (and development is pretty much dead) + the utter lack of tools and third-party support so I will have to stick with Lua.. and try very hard to forget Io again.
[+] [-] adambard|12 years ago|reply
[+] [-] silentbicycle|12 years ago|reply
The C interop is also a Big Deal. Lua seems like a cute little language, like a cleaner Javascript, but it's a LOT more useful if you're also proficient in C. Also, Lua will run anywhere you have an ANSI C compiler and a modest amount of space.
[+] [-] chalst|12 years ago|reply
I would cover assert() statements and the common (exit_status, result) var return, since that is so idiomatic. Maybe also loading chunks.
[+] [-] sharkbot|12 years ago|reply
[1] http://www.lua.org/manual/5.2/manual.html#3.4.10
[+] [-] anonymoushn|12 years ago|reply
[+] [-] tylerneylon|12 years ago|reply
[+] [-] outworlder|12 years ago|reply
On that note, I don't understand all the javascript craze. Lua has been around for quite some time, and it's small, with well-defined semantics, a nice set of features, the interpreter is small and very fast, you can get even faster with LuaJIT, etc. Browsers should have adopted that ages ago.
[+] [-] fhd2|12 years ago|reply
I also found it considerably easier to integrate than something like V8, and it appears to be easier to use for non-programmers.
It definitely deserves to be more popular.
[+] [-] saraid216|12 years ago|reply
Someone still has to actually do the work. Then it has to get adoption. No one has bothered to do either.
[+] [-] seabee|12 years ago|reply
[+] [-] dagurp|12 years ago|reply
[+] [-] alecdbrooks|12 years ago|reply
(Disclaimer: The missions look good, but I haven't personally tried them.)
[+] [-] jballanc|12 years ago|reply
[+] [-] daenz|12 years ago|reply
[+] [-] agscala|12 years ago|reply
http://andrewscala.com/vimscript/
[+] [-] programminggeek|12 years ago|reply
Having a great tool that gives great feedback right away makes learning a language more fun IMO.
[+] [-] potomak|12 years ago|reply
After learning Lua I also suggest to take a look at MoonScript[2] a dynamic scripting language that compiles into Lua, you can think about it as the CoffeeScript of Lua.
[1] http://love2d.org/
[2] http://moonscript.org/
[+] [-] seclorum|12 years ago|reply
Since I became a Lua programmer, I really can't stand any other languages, and I've rapidly switched to it for my scripting needs. Tables are just soooo lovely. ;)
[+] [-] jamesbritt|12 years ago|reply
There were the expected "WTF?" moments but having something running and doing something practical is a great motivator.
[+] [-] hanjos|12 years ago|reply
One nitpick: local function declarations, like
are actually the same as writing . Without that first local g; statement, local functions wouldn't be able to call themselves recursively.[+] [-] tylerneylon|12 years ago|reply
[+] [-] piqufoh|12 years ago|reply
[+] [-] chubot|12 years ago|reply
Python is actually much bigger nowadays -- I would challenge someone to come up with something this simple that doesn't leave out a lot of stuff you will encounter in real code.
The extra features ("bloat") do matter. I like the idea of Lua a lot, but when I started programming in it, it unfortunately felt like a less capable Python to me.
[+] [-] znowi|12 years ago|reply
It was interesting to find resemblance of Lua's classes to Perl's blessing. Always meant to look into the language and this tutorial made me do it.
I also learned about the LÖVE game engine, which I'm going to play with this week. Thank you!
http://love2d.org/
[+] [-] bananpermobil|12 years ago|reply
[+] [-] unknown|12 years ago|reply
[deleted]
[+] [-] thyrsus|12 years ago|reply
That took me 30 minutes to read. I think I might feel like I've learned the language after spending 8 hours working the examples a la "Learn Python the Hard Way". Luckily, I'm not competing with the folks here that learned it within 15 minutes ;-).
[+] [-] tylerneylon|12 years ago|reply
I wanted to express something like "hey, this guide is for programmers and is surprisingly short and easy to consume considering it covers the large majority of the language." The current title seemed a bit snazzier.
[+] [-] lukefreiler|12 years ago|reply
[+] [-] digitalsushi|12 years ago|reply
Here's one
http://www.lurklurk.org/rosetta.html
[+] [-] makeset|12 years ago|reply
[+] [-] Dylan16807|12 years ago|reply
I've seen people say they've never seen complaints about fonts being too big? Well here I am, complaining that the fonts are so big this page is hard for me to read without zooming out.
[+] [-] spacecowboy|12 years ago|reply
[+] [-] nathas|12 years ago|reply
[+] [-] noonespecial|12 years ago|reply
I do wish someone had handed me this on the first day I realized I needed lua.
[+] [-] ErikRogneby|12 years ago|reply
nice write up comparison of lua based game engines: http://www.gamefromscratch.com/post/2012/09/21/Battle-of-the...