Calling JsCallFunction with arguments?
I'm working on a "Script Loader" that loads .js files from a specific path and runs the code within through the chakra environment, with this I've been able to make something like for the script:
function onTick() { // Do Stuff };
and have a tick on the C++ end that not only finds this function in the script but then executes it.
But I wanted to know was how I can pass arguments through the function call (on the C++ end) like:
function onTick(objectOfSomething) { // Do stuff with the passed variable };
You need to feed off the arguments variable of JsCallFunction with an array where first must be set to an object or invalid reference as it controls the this value inside the called function and other entries with arguments you want to pass, and argumentsLength must also be set to minimun of 1 becuase of the this value inside the array as its first indexed value.