I’ve had a hard time calling a function that takes multiple parameters going from JavaScript to C++. For example, I tried working with the sample plug-in, trying to modify the “MyEcho” to accept two parameters. This is the sample C++ code for extracting the first parameter:
// Allocate space for the first argument
addon_value arg1;
size_t argc = 1;
Check(UxpAddonApis.uxp_addon_get_cb_info(env, info, &argc, &arg1, nullptr, nullptr));
// Convert the first argument to a value that can be retained past the
// return from this function. This is needed if you want to pass arguments
// to an asynchronous/deferred task handler
Value stdValue(env, arg1);
uxp_addon_get_cb_info
isn’t well documented, but I was hoping incrementing argc would point it at the second parameter. That doesn’t work, however - argc always comes out with a value of 2, and it always returns the first parameter, regardless of what argc is set to.
Any insight here?
Thanks!
Lawrence