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.
Learn Lua in 15 Minutes
61–70 of 99 posts
Re: Learn Lua in 15 Minutes
#62 -- Variables are global by default.
thisIsGlobal = 5 -- Camel case is common.
-- Undefined variables return nil.
-- This is not an error:
foo = anUnknownVariable -- Now foo = nil.-- Only nil and false are falsy; 0 and '' are true!
Didn't read further. Bad language design. Must die.
Re: Learn Lua in 15 Minutes
#63Anyone else catch the Gauss reference[1] in the for loop section? [1] http://en.wikipedia.org/wiki/Carl_Friedrich_Gauss#Anecdotes
Re: Learn Lua in 15 Minutes
#64I love this. I'd like/pay to have a consistent library of exactly this for other languages.
Re: Learn Lua in 15 Minutes
#65Anyone else catch the Gauss reference[1] in the for loop section? [1] http://en.wikipedia.org/wiki/Carl_Friedrich_Gauss#Anecdotes
Re: Learn Lua in 15 Minutes
#66Anyone else catch the Gauss reference[1] in the for loop section? [1] http://en.wikipedia.org/wiki/Carl_Friedrich_Gauss#Anecdotes
(so, yes. :P)
Re: Learn Lua in 15 Minutes
#67Anyone else catch the Gauss reference[1] in the for loop section? [1] http://en.wikipedia.org/wiki/Carl_Friedrich_Gauss#Anecdotes
You have a keen eye for subtle references! I didn't expect many people to get that one :) There's another math anecdote reference hidden in there as well - probably even more obscure than Karl's sum.
Re: Learn Lua in 15 Minutes
#68Great sheet. -- Variables are global by default. thisIsGlobal = 5 -- Camel case is common. -- Undefined variables return nil. -- This is not an error: foo = anUnknownVariable -- Now foo = nil. -- Only nil and false are falsy; 0 and '' are true! Didn't read further. Bad language design. Must die.
The last one is awesome.
Re: Learn Lua in 15 Minutes
#69A logical next step might be to do do the Lua Missions (read: koans): https://github.com/kikito/lua_missions . (Disclaimer: The missions look good, but I haven't personally tried them.)
Re: Learn Lua in 15 Minutes
#70This 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…
I would cover assert() statements and the common (exit_status, result) var return, since that is so idiomatic. Maybe also loading chunks.