Here’s the short summary breakdown:
- lua.vm.js: An asm.js (emscripten) port of Lua 5.2. It has slickest web presence, but WORST implementation. It’s crazy buggy and doesn’t work for anything beyond the cool tech demo. If you really like what they have so far, you’ll want to spend a week or so fixing their API so it actually works for non-trivial programs. I never got my game working fully with this due to sporadic runtime errors and other mess.
- lua.js-phil: A fork of lua.js. I added string.format and improved performance by making the following assumptions: you will not use meta-methods (__index, __call) for anything but calling functions / methods. You will not use the math meta-methods (__add, …).
Here’s the performance data in FPS. For comparison, with Lua running on my Mac, I got 400 FPS.
|Chrome 31||Firefox 25||Safari 7||IE 10||Average|
So to conclude, lua5.1.js would be my preference, except asm.js code takes a horrible performance hit on Safari, and a non-trivial performance hit on IE. Once all browsers are optimized to work with asm.js code, that would be the best option for sure. Since I was able to modify my game (about 5 lines of code different) to work with those restrictions I mentioned above, I was able to get pretty good performance with my fork of lua.js. The original lua.js is quite good, short of the missing functions.
P.S. You can download the whole mess with build scripts and the various Lua things here.