News for hackers. Stuff that matters.
Re:The evolution of Lua by Derbasti on Monday April 30, 2012 @06:57PM (#3912016)
Lua is pretty minimalistic. There are few batteries included. The standard library is very basic. There is no native object system, though implementing one is trivial.

That said, I friggin love Lua for its flexibility and transparency. Once you grok its few basic mechanisms, everything else just falls in place. In contrast, understanding Ruby or Python is a lot more difficult since the languages themselves are a lot more complex.

In fact, if I were to teach programming, I would teach it using Lua. Implementing your own object system is increadibly instructive. Learning about coroutines and lambdas is, too. And Lua is still small enough to just read its source when in doubt. It's bytecode consists of just a few dozen instructions.

Honestly, Lua is a marvellous language and I just love to use it!

Re:The evolution of Lua by moonchrome on Monday April 30, 2012 @07:31PM (#3912132)
>In fact, if I were to teach programming, I would teach it using Lua. Implementing your own object system is increadibly instructive. Learning about coroutines and lambdas is, too. And Lua is still small enough to just read its source when in doubt. It's bytecode consists of just a few dozen instructions.

If these things appeal to you check out lisp (clojure is my personal recommendation)

Re:The evolution of Lua by ansible on Tuesday May 01, 2012 @05:31AM (#3913588)
If I were using a Lisp these days, I'd really miss the Lua table.

Lisp is built around cons cells and the linked list. But it has seperate containers of various types.

Lua is built around the Lua table, which can function as a list, array, and dictionary/hash table. You can then build any other data structure from tables easily. With a metatable, you then also get read-only tables, objects and classes, and more.

Now if someone were to design a modern Lisp based around tables...

Re:The evolution of Lua by gruseom on Tuesday May 01, 2012 @04:06PM (#3916160)
Now if someone were to design a modern Lisp based around tables...

I agree, it's an intriguing possibility. There was a thread about this a while ago:

http://news.ycombinator.com/item?id=3291065

Re:The evolution of Lua by moonchrome on Tuesday May 01, 2012 @07:16AM (#3913781)
>Now if someone were to design a modern Lisp based around tables...

Check out clojure - advanced data structures/primitives + immutability(functional programming)

Re:The evolution of Lua by ansible on Tuesday May 01, 2012 @07:56AM (#3913889)
I don't really want multiple data structure primatives though, just the one. And have the language built up around it.

I have been mulling over better support for immutable data structures in Lua, but I haven't figured out a good and clean design yet.

Re:The evolution of Lua by BystanderX on Tuesday May 01, 2012 @01:17AM (#3913128)
Lua itself can stand pretty well, especially with LuaJIT2. That said, I'm starting to learn Lisp right now (Clozure/OpenMCL), and coming from primarily Lua development in the last two years, it seems much less like the leap many play it out to be..

Instead, it has seemed more like simply stepping from a clean, compact room into a large, similarly clean and smooth room but with depth you hadn't imagined before.

Well, that and learning Emacs compared to ST2 is a bit of a step at the same time.

Re:The evolution of Lua by Derbasti on Tuesday May 01, 2012 @03:05AM (#3913337)
I know a bit of eLisp and I quite like it. Frankly, it's not that Lisp syntax is bad (it's wonderful), but most popular languages have a C-derived syntax. For teaching to non CS-types, the target is probably a C-like language and I guess Lua is closer to that than Lisp.
Re:The evolution of Lua by mangodrunk on Tuesday May 01, 2012 @06:01PM (#3916575)
I tried to get into Lua, but with issues with installing LuaRocks and the library I was using, LuaFileSystem, I wasn't all that impressed. This could most likely be the library I was using or I didn't give it enough time. So, could you go into more detail about Lua's flexibility and transparency and what is it that you grokked about the few basic mechanisms? What about library support? It seemed that LuaRocks was the most popular module manager and it didn't seem to have that many libraries, and some seemed to be orphaned. My question is if you have experience with this or is this a mischaracterization of things?

I wanted to start out using Lua as a scripting language which may not be a good fit, but it seemed more compelling than other languages I was looking into.

Re:The evolution of Lua by gruseom on Monday April 30, 2012 @10:51PM (#3912771)
Lua is pretty minimalistic. There are few batteries included. The standard library is very basic.

To what extent does its easy C interop make up for this?

Re:The evolution of Lua by dyselon on Tuesday May 01, 2012 @01:15AM (#3913125)
It helps quite a bit. It's really easy to write a glue layer between Lua and whatever C library you want. The downside is that you still have to actually write that glue.

It should probably be noted that Lua gets along less well with C++, so that glue is a bit harder to write for C++ libs. There are tools that will automatically generate that glue for C++, but I'm not familiar with them.

Re:The evolution of Lua by BystanderX on Tuesday May 01, 2012 @01:19AM (#3913133)
As Dyson said, it's fairly easy.

LuaJIT2's ffi also makes it a lot quicker.

Re:The evolution of Lua by RegEx on Monday April 30, 2012 @07:26PM (#3912112)
Do you have any recommended resources for programmers looking to pick up Lua?
Re:The evolution of Lua by telemachos on Monday April 30, 2012 @07:41PM (#3912169)
Roberto Ierusalimschy's Programming in Lua, 2nd Ed. is an absolute gem. Well written, concise and very authoritative (he's one of the language's co-creators).

One thing worth knowing though: he's working on the 3rd edition (updated for Lua 5.2), though I'm not sure how soon that is expected.

The first edition is online, if you want to get an idea what it's like: http://www.lua.org/pil. In addition, the language's refrence manual is freely available online as well. Depending on how you learn, that would get you started very quickly. (It's a small language and very much follows the principle of least surprise - except for indexing arrays from 1, but you get used to that.) http://www.lua.org/docs.html has the full reference manual for 5.1 and 5.2.

Re:The evolution of Lua by Derbasti on Tuesday May 01, 2012 @03:07AM (#3913343)
Seconded, the book is friggin awesome, if a bit dry. It is written for an experienced programmer though.

Personally, I learned object orientation through this book. I knew basic OO before, but this book really explained it to me.

Re:The evolution of Lua by anonymoushn on Monday April 30, 2012 @07:41PM (#3912168)
Programming in Lua seems to be the best choice, but mostly by virtue of the very small number of coices. It was most recently printed in 2006, but there were few breaking changes since then, and you won't run into them very often.

To be honest, I learned it using only the tutorial here: http://lua-users.org/wiki/LuaTutorial and google.