Please tell me this article is a hoax:
This guy studies Computing Science and writes :<p>"Javascript is written in Java and meant to script Java programs"<p>"Javascript only runs on the JVM, which is only available on web browsers. That is only one platform. LUA runs on any CPU that can run assembly code, since LUA was written in C which is portable assembly. It is more portable."<p>Just one comment : please study more.
There's a lot to like about Lua but the one thing that stops me taking it seriously is that it doesn't have arrays or lists. Its only data structure is an infinite associative map (called a table), in which all keys map to the value "nil" unless otherwise set.<p>When you need a list, convention is to use a table with integer keys. But, the standard library functions dealing with these "lists" interpret the list as ending at the first element whose value is nil! There is no separate length field or anything (there was, but they took it out).<p>So, you can't just trust that a list is a generic structure that can hold anything -- you need to be on the lookout for "nil", because inserting it into a list truncates the list to that position.<p>There are many crazy workarounds for this: <a href="http://lua-users.org/wiki/StoringNilsInTables" rel="nofollow">http://lua-users.org/wiki/StoringNilsInTables</a><p>But my workaround is to just not use Lua, because as many warts as JS has, it has nothing as bad as that IMO. It's a shame, because Lua is otherwise an excellent language.
What is this even. I think Lua is better too, but this article is really bad. Also it's Lua, not LUA. I couldn't even read it in full after spotting things like "Javascript only runs on the JVM" and "Games are harder than web and programmers choose the best tool for the job, so LUA is a better tool and Javascript wouldn't be able to handle it"<p>EDIT: oh, I missed the first paragraph "I want to note that the language is technically called "Lua" and the authors explicitly request people to refrain from calling it LUA, but I always shout whenever I say it in real life", good troll :|
Lua is better than JavaScript, sure, but this article doesn't make a convincing argument for that proposition. In fact, I might argue that it has a negative effect on any such arguments that may be posted, by virtue of association.
Lua is definitely better than JavaScript. Anyone well versed in both languages knows this, I'm undoubtably sure.<p>But I like that no one uses it. If people knew how much better Lua was over JavaScript, it might ruin the ecosystem with amateurs.
<p><pre><code> LUA doesn't have any of that functional baloney built into
it like Javascript. It doesn't have Objects either. Leave
that cruft to Java, Javascript, and all the other clunky
enterprise languages like them. Programming in LUA is the
way it's supposed to be, imperative.
Conclusion: LUA is hardcore and lightweight, like C.
</code></pre>
Actually, Lua was intentionally designed to support functional programming and strong function composition. Lua supports proper tail calls and lexical closures. The former is necessary for functional programming, and the latter makes function composition easier as a practical matter, especially when you consider that...<p>... one of the beauties of Lua is that you can write "Lua" in either Lua or C. That is, the Lua language was designed so that the Lua C API was a first-class citizen. A Lua function written in C has full access to the power of lexical closures as well as stackful coroutines. (See the paper "Passing a Language through the Eye of a Needle" at <a href="http://queue.acm.org/detail.cfm?id=1983083" rel="nofollow">http://queue.acm.org/detail.cfm?id=1983083</a>) No other language benefits from such attention to detail in that regard. If you don't understand the beauty of the Lua C API, then you don't understand Lua.<p>Also, object oriented programming in Lua is prototype based, just like in JavaScript. But Lua is definitely hardcore and lightweight and fast, even though it's a much more sophisticated language than both JavaScript and Python in terms of language abstractions.<p>I think people get the idea that Lua isn't sophisticated because it's so simple--that is, it has a small repertoire of language features, and the implementation is small and comprehensible. But that's largely a product of the fact that while Lua is over 20 years old, it never committed to strong backwards compatibility.<p>Lua 5.3 is the product of decades of ruthlessly discarding failed experiments, and carefully introducing new experiments. And this shows if you pay close attention to the details of the language features, semantics, and API.<p>For example, look at Lua's stackful coroutines. Some consider call/cc (call with current continuations) the ideal abstraction, but Lua's choice of asymmetric stackful coroutines was carefully considered. The paper 2004 paper "Revisiting Coroutines" (<a href="http://www.inf.puc-rio.br/~roberto/docs/MCC15-04.pdf" rel="nofollow">http://www.inf.puc-rio.br/~roberto/docs/MCC15-04.pdf</a>) by one of the Lua authors is widely cited in this area of language research and design.<p>Lua's lack of backwards compatibility is a stumbling block for uptake. But it's asymptotically approaching the perfect language of it's kind (dynamically typed, etc). The period between major releases seems to be growing (5+ years now), and the changes fewer. The future is bright.