Created
February 11, 2015 14:02
-
-
Save bnjbvr/2aa99d0e3bd66f5759fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static bool add (JSContext *cx, unsigned argc, jsval *vp){ | |
JS::CallArgs args = CallArgsFromVp(argc, vp); | |
std::cout<<(args[0].toInt32()+args[1].toInt32()); | |
RootedFunction func(cx, JS_ValueToFunction(cx, args[2])); | |
// JSFunction* function; | |
JS::RootedValue rval(cx); | |
JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx)); | |
JS_CallFunction(cx, global, &func, 0, nullptr, &rval); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment