> ...or even better, if there is a way to pass a user pointer
> to a function and get it back when the C function is called?
You can use the JS_SetPrivate and JS_GetPrivate functions to set/get a
user pointer on the object that the JS function is associated with.
The object the JS function is associated with is the one you passed
into the JS_DefineFunction function. When your C function gets called,
it is passed a context and the object that the JS function was
associated with. You would use JS_GetPrivate to get your pointer back
which inside the C function.