Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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 is a much smaller language and overall it is much more consistent and has less corner cases than Javascript since the language had the opportunity to evolve over the years instead of needing to retain backwards compatibility with browsers from 1995. For example:

* 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.


> Javascript being used by non programmers is 95% of the problems with javascript..

Well, I wasn't advocating Lua as a good language for non-programmers to write programs, but for scripting. When I make games/applications scriptable, it's closer to configurating than programming, and Lua's table constructors allow for great declarative DSLs.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: