3 ms·
90% of what's in npm or pip is not trivial to write. Calling database adapters or HTTP libraries "distractions" is silly. And in the same sense, restricting you
by striking 10y ago
90% of what's in npm or pip is not trivial to write. Calling database adapters or HTTP libraries "distractions" is silly. And in the same sense, restricting yourself to a subset of a language that makes it easily ported and contained within any application seems... silly.
Furthermore, plugging together pieces of other people's code can very much help in learning how to express concepts in the language. You can look at existing examples of how it's done, and do it yourself. You make small changes, then big changes, then write your own. Easy peasy.
Lua is a weird language for many reasons. Not that being weird is a bad thing, but that makes it difficult for people to learn other languages. If you learn a C-style language, you'll be more able to read other C-style languages.
And no, metatables are integral to Lua. You can't use prototypical inheritance without them, and they're really difficult to wrap your mind around. Furthermore, prototypical inheritance is very useful. If you've actually learned Lua, you've got to learn about that aspect of metatables.
I love Lua for real work. Honestly, actually do. But I don't love Lua for learning.
- enkiv2 10y agoYou need metatables for rolling your own OO system. But, object orientation (particularly when, as in Lua, you need to roll your own) should not be part of a beginner curriculum. Like I said, by the time you need to worry about metatables, you should have already moved on to your second and third languages -- you can learn about OO in the context of Python or JavaScript and then later apply that to Lua.