I knew someone else had to be thinking about this!
The thing is that Node.js has kind of solved this now
The question is whether Lua's advantages over JS (more powerful, faster, excellent FFI) can be exploited server-side to create significant value beyond Node.js. If the answer is no, the idea is pointless.
Lua is also not without its annoyances (1 indexing, and to me begin/end is a big pain over {}).
1-indexing is the sort of thing that could screw up cross-compilation. That's a worry. Begin/end - I agree with you, but don't have to deal with it because I write my JS in Lisp. Personally what I have in mind is a Lisp that compiles to JS and Lua.
it's even uglier to have to worry about the transliteration to 2 different languages.
Right. The idea lives or dies on how bad the semantic delta is between Lua and JS (in some subset of both languages chosen for compatibility). The impedance mismatch has to be really small to make it worthwhile. It's not obvious if that's the case.
But since CoffeeScript became popular
I don't see how the impedance mismatch argument is any different for CoffeeScript/Lua than it is for JS/Lua.
A third thing is that libraries would be totally different. You would have to bind the same libraries to JS and Lua to get any kind of portability. In the end I think that's not worth it for any project.
Projects that don't depend heavily on client-side JS libraries wouldn't suffer too much.
There's a node.js style API for Lua, but again it won't be "write once run anywhere".
I don't find it very interesting, since you can just use Node.js for that style. The goal here isn't to cross-compile to Lua and Node.js. It's to cross-compile to Lua on the server and JS in the browser.
A last motivation was the C API of Lua
Right, that's potentially a big deal. For example, you could run your server app in Lua embedded in Nginx. I know people have been working on this.