News for hackers. Stuff that matters.
Re:MuJS: an embeddable JavaScript interpreter by 0x0 on Monday March 16, 2015 @07:22PM (#9215189)
Strange that the example has 'js_dofile("config.lua")'... Is there lua in here?
Re:MuJS: an embeddable JavaScript interpreter by passthefist on Monday March 16, 2015 @08:16PM (#9215477)
Which begs the question: why not use Lua to begin with, at least when starting a project? I totally get the use for this if you've got some existing JS and for some reason you need to talk to C. I've seen crazier things.

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.

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

Re:MuJS: an embeddable JavaScript interpreter by xavel on Monday March 16, 2015 @08:16PM (#9215475)
I noticed that too. My theory is that MuJS started out as a fork of Lua, with all sorts of Ecmascript-compat bolted on. Use with care, I suppose.