6 ms·
Lua Doesn't Suck – Strange Loop 2010 20-minute talk video
- wyclif 16y agoFull version of "Programming in Lua", available for free on Google Books: http://books.google.com/books?id=ZV5hXZ8QPKIC http://books.google.com/books?id=ZV5hXZ8QPKIC
- probablycorey 16y agoThat book is a little dated because it deals with Lua 5.0 but is still good. The differences between 5.0 and 5.1 can be found here http://www.lua.org/manual/5.1/manual.html#7 http://www.lua.org/manual/5.1/manual.html#7 and new version of the book can be found on amazon.
- silentbicycle 16y agoIt will still give you a good taste of the language, but PiL 2nd ed. and the reference manual will be much more useful in the long run.
- tung 16y agoAlso available on its official site: http://www.lua.org/pil/ http://www.lua.org/pil/
- indigoviolet 16y agoI haven't seen the video [do they discuss this?], but the biggest problem I have with Lua is its lack of good unicode support. The Lua wiki suggests slnunicode and ICU4Lua, but neither library has been updated for a year. I'd love to use Lua instead of Python for some tasks, given that LuaJIT kicks ass. But poor support for something as important as unicode is a deal breaker. Am I just missing some information in this regard?
- jacques_chester 16y ago> Am I just missing some information in this regard? A major, and non-negotiable, design goal of Lua is that it targets the ANSI C environment to maximise portability. ANSI C does not define Unicode support. Incidentally, those two libraries might be unchanged because they're stable. The rate of change in the main lua implementation is quite measured.
- kylecordes 16y ago(I'm the guy in the video.) I haven't had a need for Unicode in Lua, but when I stumbled across some information about it, the essential story was that there is nothing stopping you from writing code to manipulate Unicode data (obviously), but there is also nothing built in to help you. All the built in string stuff is ANSI/ASCII/whatever. However, the language Io (which often gets mentioned in the same breath as Lua, though it's quite different in some ways) has a stronger Unicode story: http://www.iolanguage.com/scm/io/docs/IoGuide.html#Unicode http://www.iolanguage.com/scm/io/docs/IoGuide.html#Unicode
- metamemetics 16y agoAre you affiliated with Lambda Lounge in STL?
- kylecordes 16y agoYes! I know the guy who started Lambda Lounge (Alex Miller http://tech.puredanger.com/about http://tech.puredanger.com/about ) and heartily supported its founding; I spoke at it every once in a while; and my firm (Oasis Digital http://oasisdigital.com/ http://oasisdigital.com/ ) sponsors Lambda Lounge by paying for travel expenses for out-of-town speakers. Lambda Lounge is the best software dev user group ever.
- puredanger 16y agoI'm Alex Miller, the founder of Lambda Lounge. If you want to drop me a line email me at contact at puredanger.com
- netghost 16y agoI'd say lua is great, well good, it's just that it's entirely reasonable, which makes it kind of boring ;) It as been the least surprising language I've used.
- silentbicycle 16y agoThere's deep stuff there (look into coroutines and metatables), but Lua has been carefully designed so that it doesn't get in the way. If all you want from Lua is a (JSON-like) format for data dumps or config files, you can safely ignore the rest of the language. It's like the opposite of C++ that way. :)
- kylecordes 16y agoThat is exactly how I introduced Lua in to one of our projects: as a very - little code way to handling a complex configuration situation. It grew in to full scriptability.
- mfollett 16y agoGreat talk, Kyle. Also, the video turned out remarkably well given the camera it came from.
- kylecordes 16y agoThanks. Here is the exact camera I used: http://www.usa.canon.com/cusa/support/consumer/digital_cameras/other_powershot/powershot_sx100_is http://www.usa.canon.com/cusa/support/consumer/digital_camer... For the sake of any readers here who don't read the blog post: I do NOT recommend this camera for video. I happened to have it sitting around for family snapshots and chose to experiment with it here.
- __david__ 16y agoI've sat down to learn Lua a number of times because on the I really like the idea of it (small, fast, safe, etc). It really has quite a beautiful minimalism to it. But each time I try I get to the part where I learn that array indices start at 1 and I get annoyed. Have we not learned anything since BASIC? Sigh.
- JulianMorrison 16y agoWhat do you object to in counting from 1? (Other than it's not traditional.) In C, it's an offset into a typed block of memory, so 0 indexing makes sense. But lua does not deal directly with memory.
- __david__ 16y agoIt has nothing to do with indexing memory--it has to do with 1 based arrays causing "+1" and "-1" to be sprinkled all oever the place. I find Dykstra's argument to be compelling: http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EW...
- kemayo 16y agoMy experience with Lua hasn't seen this problem materialize.
- tryp 16y agoI found that adopting the native idioms meant never having to notice the 1- based indexing. Everything is a hash table, and if you find yourself using literal numeric keys, there's probably a nicer way to do it. The lua users wiki is full of interesting ideas for tackling the basics in ways that leverage lua's simple flexibility.
- __david__ 16y agoThat is entirely possible. I can tell if someone doesn't know perl or python because they write for loops like a C coder instead of looping over containers. So I can believe that you don't come in contact with that detail very often. It just bugs me that such an obvious wart exists in an otherwise very clean language.
- olliesaunders 16y agoVery unscientific but hopefully interesting: $ time php -r 'echo "Hello, world!";' # smaller php binaries can be compiled real 0m0.555s $ time perl -e 'print "Hello, world!";' real 0m0.385s $ time ruby -e 'puts "Hello, world!"' # mri real 0m0.073s $ time python -c 'print("Hello, world!")' real 0m0.067s $ time lua -e 'print "Hello, world!"' real 0m0.013s $ time js -e 'print("Hello, world!")' # spidermonkey real 0m0.010s $ time awk 'BEGIN { print("Hello, world!") }' real 0m0.004s
- tl 16y agoYou forgot my favorite: $ time clojure -e '(println "Hello, world!")' real 0m0.781s Yeah, I know it's the JVM but still.
- avar 16y agoYou're right about one thing. That is very unscientific. You're mainly testing your file system cache, not these programming language implementations. E.g. perl(1) is faster than ruby(1) at printing "Hello, world!". But since you presumably had ruby hot in cache and not perl the latter seems to be almost 4 times as slow. Here's a better benchmark, which runs each of these 500 times and takes the average: http://gist.github.com/630868 http://gist.github.com/630868 Which yields these results: Rate clojure php emacs python ruby js perl awk lua shell C clojure 0.844/s -- -97% -97% -98% -99% -99% -99% -99% -99% -99% -100% php 24.6/s 2812% -- -2% -43% -75% -76% -78% -82% -82% -84% -89% emacs 25.2/s 2882% 2% -- -41% -74% -75% -78% -81% -82% -84% -88% python 43.0/s 4995% 75% 71% -- -56% -58% -62% -68% -69% -72% -80% ruby 96.7/s 11361% 294% 284% 125% -- -5% -15% -28% -29% -38% -55% js 101/s 11919% 313% 303% 136% 5% -- -11% -24% -26% -35% -53% perl 114/s 13397% 364% 353% 165% 18% 12% -- -15% -17% -27% -47% awk 134/s 15743% 444% 431% 211% 38% 32% 17% -- -2% -14% -38% lua 137/s 16134% 458% 444% 219% 42% 35% 20% 2% -- -12% -36% shell 156/s 18359% 534% 519% 262% 61% 54% 37% 17% 14% -- -28% C 216/s 25440% 777% 756% 401% 123% 113% 89% 61% 57% 38% -- Update: Added a C program and ran the shell program in a sub-shell (since perl's system function preloads a shell). Didn't add silentbicycle's SWI Prolog and OCaml since he didn't provide the source.
- olliesaunders 16y agoFor a time I was seriously considering using Lua for building web applications but after playing with it for a four days I decided the community just wasn't ready and I wasn't prepared to put in the work myself. A lot of the libraries were incomplete/being changed (lots of bitrot) and very few unit tests. As a language though Lua is pretty cool, a cleaner, smaller, faster, JavaScript.