I do wish someone had handed me this on the first day I realized I needed lua.
Learn Lua in 15 Minutes
41–50 of 99 posts
Re: Learn Lua in 15 Minutes
#42This 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.
Thanks. My goal was to write the tutorial I wish I had when I started. Your description also matches my own preferred learning style.
Re: Learn Lua in 15 Minutes
#43Re: Learn Lua in 15 Minutes
#44Earlier quoted context omitted.
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.
Lua and Javascript are quite similar in that way: nice little languages that fall apart really quickly when you try building anything reasonably large or complex. I don't really understand the attraction, except in certain niches like Lua as an embedded scripting engine, when you really need something that can be trivially sandboxed.
Isn't that exactly the reason JavaScript exists in the first place (i.e.: an embedded scripting engine for browsers) ?
Re: Learn Lua in 15 Minutes
#45The 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.
Re: Learn Lua in 15 Minutes
#46Having a font size of 25.33pt makes the website impossible to read without zooming out 3 steps. I would be happy if people stopped using tiny and huge default font sizes.
Re: Learn Lua in 15 Minutes
#47This 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.
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...
Re: Learn Lua in 15 Minutes
#48This is awesome. 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.
Maybe when it supports unicode
Not POSIX.
Plain old C.
Until C11, unicode didn't exist in C. And it will be a long time before C11 is the default. Hell, there's lots of places where C99 is the exotic interloper.
Re: Learn Lua in 15 Minutes
#49Earlier quoted context omitted.
Yeah, I see Lua in many ways as "JavaScript done right". 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.
Javascript being used by non programmers is 95% of the problems with javascript.. care to explain your problems with js and maybe expand on how lua is done right?
* Lua has proper lexical scoping instead of the confusing "function scoping" of Javascript (so there is no need to use the IIFEs hack).
* Lua has a Python-style lexicaly scoped self instead of the error prone dynamically scoped "this". No need to use `var taht = this` if you have nested functions.
* The metatable system is much more flexible than the simple JS prototypal inheritance system (you can sort of implement "method missing" instead of being forced to only delegate to a concrete table.
* You can use anything as a Lua table key. In JS all keys are converted to strigns. Lua also supports weak references.
* Coroutines! Its sort of like ES6 generators and is super awesome. Async programming is infinitely more pleasant in Lua than it currently is in JS because you don't need to convert code to continuation passing style.