Re:MuJS: an embeddable JavaScript interpreter
by namuol on Tuesday March 17, 2015 @12:13AM
(#9216244)
Seeing as this was built by the creators of MuPDF [1], I'm guessing they built this because they need to use JS to support embedded JS forms.
1: http://www.mupdf.com/ (artifex)
Re:MuJS: an embeddable JavaScript interpreter
by yellowapple on Monday March 16, 2015 @08:53PM
(#9215603)
I'm personally not a fan of Lua at all (nor am I a fan of Javascript...).
That said, there are plenty of other options out there. Even for JS embedding, there are projects like duktape that already address this need (supposedly; I haven't personally used duktape in any of my projects).
But I'd say the solution to 'I need a scripting language to talk to C' is solved very well by Lua.
*Edit:
After looking at the example it's C API is surprisingly similar to Lua's, even using such keywords as userdata. So that's interesting, considering they're really similar languages.
The function js_dofile doesn't look like it's doing anything with lua, nor can I find any use of lua at a cursory look at the source. I'd guess that since Lua and JS share syntax they are loading a .lua file with valid JS syntax.