I recently started to see how to integrate a generic script language into my voxel editor Goxel.
1. SIMPLICITY TO EMBED
Both Lua and Duktape are relatively easy to embed into a C application. They use the same stack based approach that is both flexible and simple in term of API. The C functions you want to expose need to take a stack object from which you can retrieve the arguments passed to the function. Output from functions are also passed into a stack.
Duktape API is almost identical to Lua, so there is not much to compare here. I tend to find Duktape API slightly simpler, mostly because the library is provided as a single C file with a corresponding header file.
In my opinion Duktape has a better documentation than Lua. Most of the time just reading the comments in the header file is enough to find what a function does. The online doc is using nice diagrams to explain how each function will affect the stack. This is really helpful since it's not always obvious if a call will pop it's arguments from the stack or not.
Lua's website contains a link to a free version of the book 'programming in Lua', but it only covers Lua 5.2 and so some of the examples are not working anymore.
One thing I don't like much in Lua is the fact that the arrays are one indexed. This is specially annoying for Goxel since the scripts will have to index into multi dimensional arrays for which zero indexed is the only sane way. As an example, this is how you would index a 2d image memory block in Lua:
img[(y - 1) * w + x]
img[y * w + x]
[1, 2] + [3, 4]
Evaluate to the string:
'1, 23, 4'
This is where Lua is the clear winner. In my test scripts, I got results twice as fast with Lua than what I get with duktape. For most scripts that is probably not an issue, but in Goxel I would like to generate large 3D volumes from parametric functions, and for this the speed of the script interpreter is going to be critical.